예제 #1
0
        public DbResponse <int> Delivery(WarrantyDeliveryModel model, string userName)
        {
            try
            {
                if (_db.Warranty.IsNull(model.WarrantyId))
                {
                    return(new DbResponse <int>(false, "Not Found"));
                }

                var registrationId = _db.Registrations.GetRegID_ByUserName(userName);
                if (registrationId == 0)
                {
                    return(new DbResponse <int>(false, $"Invalid User"));
                }

                //Product Logs
                var details = model.ChangedProductCode != "" ? "Changed ProductCode: " + model.ChangedProductCode: "";
                var logs    = new ProductLogAddModel
                {
                    SellingId                = model.SellingId,
                    ProductStockId           = model.ProductStockId,
                    ActivityByRegistrationId = registrationId,
                    Details   = $"Warranty Product Delivered {details}",
                    LogStatus = ProductLogStatus.WarrantyAcceptance
                };

                _db.ProductLog.Add(logs);
                return(_db.Warranty.Delivery(model));
            }
            catch (Exception e)
            {
                return(new DbResponse <int>(false, $"{e.Message}. {e.InnerException?.Message ?? ""}"));
            }
        }
예제 #2
0
        public IActionResult PostDelivery(WarrantyDeliveryModel model)
        {
            var response = _warranty.Delivery(model, User.Identity.Name);

            return(Json(response));
        }