public async Task <ResultModel> AddFloorToHostel(AddFloorViewModel model) { await _context.Floors.AddAsync(model.Adapt <Floor>()); return(await _context.SaveAsync()); }
public async Task <JsonResult> AddFloor(AddFloorViewModel model) { return(!ModelState.IsValid ? Json(new ResultModel().AttachModelState(ModelState)) : Json(await _hostelService.AddFloorToHostel(model))); }