public int UpdateDataToDb(BusinessObjects objects, PersonalData newPersonal, EducationalData newEducational, ContactData newContact) { int status = 5; try { /// Updating Status UserCredential Credentials = newPersonEntity.UserCredentials .First(cd => cd.UserName == objects.UserName); Credentials.Status = objects.Status; /// Updating Data switch (objects.FormId) { case 1: PersonalData personal = newPersonEntity.PersonalDatas.First(dt=>dt.UserName==objects.UserName && dt.FormName==objects.FormName); /// Suggest Code Here default: break; } /// Saving Changes to Db return newPersonEntity.SaveChanges(); } catch (Exception ex) { CatchError(ex); return 3; } }
... personal.PropertyToChange = newValue; newPersonEntity.Entry(personal).State = EntityState.Modified; ...
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)