/// <summary> /// Convert Discpline Entity into Discpline Object /// </summary> ///<param name="model">DiscplineViewModel</param> ///<param name="DiscplineEntity">DataAccess.Discpline</param> ///<returns>DiscplineViewModel</returns> public static DiscplineViewModel ToViewModel( this DataAccess.Discpline entity, DiscplineViewModel model) { model.Id = entity.Id; model.Name = entity.Name; model.IsActive = entity.IsActive; return(model); }
/// <summary> /// Convert Discpline Object into Discpline Entity /// </summary> ///<param name="model">Discpline</param> ///<param name="DiscplineEntity">DataAccess.Discpline</param> ///<returns>DataAccess.Discpline</returns> public static DataAccess.Discpline ToEntity(this DiscplineViewModel model, DataAccess.Discpline entity) { if (entity.Id == 0) { entity.CreatedUserId = model.SessionUserId; entity.IsActive = model.IsActive; } else { entity.UpdatedUserId = model.SessionUserId; entity.UpdatedTimestamp = DateTime.Now; } entity.Name = model.Name; return(entity); }