public async Task <BaseResponse <bool> > UpdateYachtMerchantProductVendor(YachtMerchantProductVendorUpdateModel model)
        {
            try
            {
                var entity        = _context.YachtMerchantProductVendors.AsNoTracking().Where(x => x.Id == model.Id && x.Deleted == false).FirstOrDefault();
                var checkSupplier = _context.YachtMerchantProductSuppliers.Any(x => x.VendorFid == entity.Id && !x.Deleted);
                if (entity != null && checkSupplier == false)
                {
                    entity.ProductCategoryFid    = model.ProductCategoryFid;
                    entity.ProductCategoryResKey = model.ProductCategoryResKey;
                    entity.Name             = model.Name;
                    entity.VendorTypeResKey = model.VendorTypeResKey;
                    entity.VendorTypeFid    = model.VendorTypeFid;
                    entity.ContactNo        = model.ContactNo;
                    entity.Email            = model.Email;
                    entity.Address          = model.Address;
                    entity.Remark           = model.Remark;
                    entity.LastModifiedBy   = GetUserGuidId();
                    entity.LastModifiedDate = DateTime.Now;

                    _context.YachtMerchantProductVendors.Update(entity);
                    await _context.SaveChangesAsync();

                    return(BaseResponse <bool> .Success(true));
                }
                return(BaseResponse <bool> .NotFound(false));
            }
            catch (Exception ex)
            {
                return(BaseResponse <bool> .InternalServerError(message : ex.Message, fullMsg : ex.StackTrace));
            }
        }
Ejemplo n.º 2
0
        public IActionResult UpdateYachtMerchantProductVendor(YachtMerchantProductVendorUpdateModel model)
        {
            var res = _yachtMerchantProductVendorServices.UpdateYachtMerchantProductVendor(model).Result;

            if (res.IsSuccessStatusCode)
            {
                return(Ok(res));
            }
            return(BadRequest());
        }