public async Task UpdateAsync(Guid currentListOfScientistId, ListOfScientistDto newListOfScientist) { var listOfScientist = await _domainContext.ListOfScientists.FirstOrDefaultAsync(e => e.Id == currentListOfScientistId); if (listOfScientist != null) { listOfScientist.Email = newListOfScientist.Email; listOfScientist.PhoneNumber = newListOfScientist.PhoneNumber; listOfScientist.FullName = newListOfScientist.FullName; listOfScientist.Position = newListOfScientist.Position; listOfScientist.ReportId = newListOfScientist.ReportId; listOfScientist.Type = newListOfScientist.Type; listOfScientist.AcademicDegree = newListOfScientist.AcademicDegree; listOfScientist.WorkPlace = newListOfScientist.WorkPlace; _domainContext.ListOfScientists.Update(listOfScientist); } }
public ListOfScientist Add(ListOfScientistDto addedListOfScientist) { var listOfScientist = new ListOfScientist() { Email = addedListOfScientist.Email, FullName = addedListOfScientist.FullName, PhoneNumber = addedListOfScientist.PhoneNumber, Position = addedListOfScientist.Position, AcademicDegree = addedListOfScientist.AcademicDegree, Type = addedListOfScientist.Type, ReportId = addedListOfScientist.ReportId, WorkPlace = addedListOfScientist.WorkPlace, }; _domainContext.ListOfScientists.Add(listOfScientist); return(listOfScientist); }