/// <summary> /// ثبت یک لاگ جدید /// </summary> /// <param name="vm"></param> /// <returns></returns> public int CreateLog(CreateRoutine2LogViewModel vm) { // map the ViewModel to a new entity var entity = Mapper.Map <Routine2Log>(vm); // Add it to database DbContext.Routine2Log.Add(entity); DbContext.SaveChanges(); // return the new id return(entity.Id); }
public ServiceResult <int> CreateLog(CreateRoutine2LogViewModel vm) { // map the ViewModel to a new entity var entity = Mapper.Map <Routine2Log>(vm); // Add it to database _context.Routine2Log.Add(entity); _context.SaveChanges(); // return the new id return(ServiceResult <int> .Okay(entity.Id)); }