public ScheduleListModel(dbModel.Schedule schedule) { Id = schedule.Id; Business = schedule.Service.Business.Name; Service = schedule.Service.Name; Price = schedule.Service.Price.ToString(); DateTime = schedule.DateTime; AssignedPerson = schedule.Personnel == null ? "Not yet assigned" : schedule.Personnel.Name; Status = schedule.Status == null ? "" : schedule.Status; }
public dbModel.Schedule ToDBModel() { dbModel.Schedule model = new dbModel.Schedule() { ServiceId = ServiceId, Note = Note, DateTime = DateTime, Status = "New", }; return(model); }
public ScheduleModel(dbModel.Schedule model) { Id = model.Id; User = new UserListModel(model.User); Personnel = model.Personnel == null ? null : new PersonnelListModel(model.Personnel); ServiceId = model.ServiceId; Service = new ServiceModel(model.Service); DateTime = model.DateTime; Note = model.Note; Status = model.Status; Comment = model.Comment; }
public dbModel.Schedule ToUpdateDBModel(dbModel.Schedule schedule) { dbModel.Schedule model = new dbModel.Schedule() { Id = schedule.Id, UserId = schedule.UserId, PersonnelId = PersonnelId == null ? schedule.PersonnelId : PersonnelId, ServiceId = schedule.ServiceId, Note = Note == null ? schedule.Note : Note, DateTime = DateTime, Status = Status == "Done" || schedule.Status == "Done" ? schedule.Status : "New", Comment = Comment == null ? schedule.Comment : Comment, }; return(model); }