public async Task <IActionResult> AddPlanner(PlannerDtoForAdd model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _response = await _repo.AddPlanner(model); return(Ok(_response)); }
public async Task <ServiceResponse <object> > AddPlanner(PlannerDtoForAdd model) { var ToAdd = new Planner { Description = model.Description, DocumentTypeId = model.DocumentTypeId, ReferenceId = model.ReferenceId, CreatedById = _LoggedIn_UserID, CreatedDateTime = DateTime.UtcNow, }; await _context.Planners.AddAsync(ToAdd); await _context.SaveChangesAsync(); _serviceResponse.Message = CustomMessage.Added; _serviceResponse.Success = true; return(_serviceResponse); }