public AttentionStaffViewModel(UserAttentionStaff userAttention) { AttentionId = userAttention.UserAttentionStaffId; Name = userAttention.Name; LastName = userAttention.LastName; Type = userAttention.Type; Photo = userAttention.Photo; ServiceStatus = userAttention.ServiceStatus; User = (userAttention.User == null)?null: new UserViewModel(userAttention.User); }
public ActionResult <AttentionStaffViewModel> Post(AttentionStaffInputModel staffModel) { UserAttentionStaff attentionStaff = MapAttentionStaff(staffModel); var response = _staffService.Save(attentionStaff); if (response.Error) { return(BadRequest(response.Message)); } return(Ok(response.Object)); }
private UserAttentionStaff MapAttentionStaff(AttentionStaffInputModel staffModel) { UserAttentionStaff attentionStaff = new UserAttentionStaff(); attentionStaff.UserAttentionStaffId = staffModel.AttentionId; attentionStaff.Name = staffModel.Name; attentionStaff.LastName = staffModel.LastName; attentionStaff.Type = staffModel.Type; attentionStaff.Photo = staffModel.Photo; attentionStaff.ServiceStatus = staffModel.ServiceStatus; attentionStaff.User = MapUser(staffModel.User); return(attentionStaff); }
public ActionResult <AttentionStaffViewModel> Modify(AttentionStaffInputModel staffModel) { UserAttentionStaff attentionStaff = MapAttentionStaff(staffModel); var response = _staffService.Update(attentionStaff); if (response.Error == false) { return(Ok(response.Object)); } else { return(BadRequest(response.Message)); } }