コード例 #1
0
ファイル: Update.cs プロジェクト: SeanWar734/CarpetHandyMan
        public override async Task <ActionResult> HandleAsync([FromBody] UpdateRetailerRequest request, CancellationToken cancellationToken = default)
        {
            var Retailer = new Retailer
            {
                Id          = request.Id,
                Address     = request.Address,
                City        = request.City,
                CompanyName = request.CompanyName,
                Description = request.Description,
                State       = request.State,
                PhoneNumber = request.PhoneNumber
            };

            _repo.UpdateRetailer(Retailer);
            await _repo.SaveAsync();

            return(Ok(Retailer));
        }
コード例 #2
0
        public async Task <IActionResult> EditRetailer([FromForm] CreateUpdateRetailerModel model)
        {
            try
            {
                if (_groupRepository.GetGroup(model.GroupId) != null)
                {
                    await _retailRepository.UpdateRetailer(model.RetailerId, model.Name, model.GroupId);

                    _emitEventLog.EventPublish("edited", $"{model.RetailerId} : {model.Name} at {DateTime.Now}");

                    return(Ok());
                }

                return(Error());
            }
            catch (Exception ex)
            {
                return(Error((int)HttpStatusCode.BadRequest, ex));
            }
        }