I am having one doubt here. After testing two if
condition, it is storing only second condition value. How to store both condition value when both the condition is true. Here after executing 2nd if
condition, 1st if
condition value is over riding.
My model is like below.
public class TimesheetError
{
public string Status { get; set; }
public string Messsage { get; set; }
public string ListErrors { get; set; }
public bool IsNotValid { get; set; }
}
My method is like below.
public TimesheetError Validate(Client client)
{
TimesheetError error = new TimesheetError();
if (client.Name.IsEmpty())
{
error.Messsage = "Bad request";
error.ListErrors = "name is not enterd";
error.Status = "Not Found";
error.IsNotValid = true;
}
if (client.Contact.FirstName.IsEmpty())
{
error.Messsage = "Bad Request";
error.ListErrors = "Contact name is not entered";
error.Status = "Not Found";
error.IsNotValid = true;
}
return error
}