コード例 #1
0
        public async Task <IActionResult> AddPlanner(PlannerDtoForAdd model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _response = await _repo.AddPlanner(model);

            return(Ok(_response));
        }
コード例 #2
0
        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);
        }