public EditProfileModel PostEditUserMethod(EditProfileModel objRegisterModel, string id) { //string result = objRegisterModel.DOB.Substring(6); int birthyear = Convert.ToDateTime(objRegisterModel.DOB).Year; int currentyear = DateTime.Now.Year; //int age = currentyear - Convert.ToInt32(result); int Yourage = currentyear - birthyear; using (var reg_repo = new RegisterRepository()) { ApplicationUser _user = reg_repo.GetById(id); _user.UserName = objRegisterModel.UserName; _user.Email = objRegisterModel.Email; _user.FullName = objRegisterModel.FullName; _user.Surname = objRegisterModel.Surname; _user.Title = objRegisterModel.Title; _user.Password = objRegisterModel.Password; _user.MaritalStatus = objRegisterModel.MaritalStatus; _user.DOB = objRegisterModel.DOB; _user.Age = Convert.ToString(Yourage); _user.Sex = objRegisterModel.Sex; _user.Address1 = objRegisterModel.Address1; _user.Address2 = objRegisterModel.Address2; _user.Address3 = objRegisterModel.Address3; _user.PostalCode = objRegisterModel.PostalCode; _user.Telephone = objRegisterModel.Telephone; _user.Employer = objRegisterModel.Employer; _user.EmployerTelephone = objRegisterModel.EmployerTelephone; _user.Occupation = objRegisterModel.Occupation; _user.NationalId = objRegisterModel.NationalId; _user.Status = objRegisterModel.Status; _user.PatientAllergy = objRegisterModel.PatientAllergy; _user.MedicalAidName = objRegisterModel.MedicalAidName; _user.MedicalAidNo = objRegisterModel.MedicalAidNo; reg_repo.Update(_user); return(objRegisterModel); } }
public EditProfileModel GETAlleditUserMethod(string id) { EditProfileModel _registerModel = new EditProfileModel(); using (var reg_repo = new RegisterRepository()) { if (id != null) { ApplicationUser _user = reg_repo.GetById(id); _registerModel.UserName = _user.UserName; _registerModel.Email = _user.Email; _registerModel.FullName = _user.FullName; _registerModel.Surname = _user.Surname; _registerModel.Title = _user.Title; _registerModel.Age = _user.Age; _registerModel.Password = _user.Password; _registerModel.MaritalStatus = _user.MaritalStatus; _registerModel.DOB = _user.DOB; _registerModel.Sex = _user.Sex; _registerModel.Address1 = _user.Address1; _registerModel.Address2 = _user.Address2; _registerModel.Address3 = _user.Address3; _registerModel.PostalCode = _user.PostalCode; _registerModel.Telephone = _user.Telephone; _registerModel.Employer = _user.Employer; _registerModel.EmployerTelephone = _user.EmployerTelephone; _registerModel.Occupation = _user.Occupation; _registerModel.NationalId = _user.NationalId; _registerModel.Status = _user.Status; _registerModel.PatientAllergy = _user.PatientAllergy; _registerModel.MedicalAidName = _user.MedicalAidName; _registerModel.MedicalAidNo = _user.MedicalAidNo; } return(_registerModel); } }