コード例 #1
0
        public string UpdateAddOns(AddOnsVM addOns)
        {
            string addOnsId = string.Empty;

            SqlParameter[] parameters =
            {
                new SqlParameter {
                    ParameterName = "@Id", Value = addOns.Id
                },
                new SqlParameter {
                    ParameterName = "@Name", Value = addOns.Name
                },
                new SqlParameter {
                    ParameterName = "@Description", Value = addOns.Description
                },
                new SqlParameter {
                    ParameterName = "@Price", Value = addOns.Price
                },
                new SqlParameter {
                    ParameterName = "@IsActive", Value = addOns.IsActive
                },
                new SqlParameter {
                    ParameterName = "@UpdatedBy", Value = addOns.UpdatedBy
                }
            };

            addOnsId = Convert.ToString(DALHelper.ExecuteScalar("UpdateAddOns", parameters));

            return(addOnsId);
        }
コード例 #2
0
        public ActionResult Edit(Guid id)
        {
            var addOns = addOnsRepository.GetAddOnsById(id);

            AddOnsVM model = new AddOnsVM();

            if (addOns != null && addOns.Count > 0)
            {
                model = addOns[0];

                return(View(model));
            }

            return(RedirectToAction("List"));
        }
コード例 #3
0
        public ActionResult Create(AddOnsVM model)
        {
            try
            {
                string addOnsId = string.Empty;
                model.CreatedBy = LogInManager.LoggedInUserId;

                addOnsId = addOnsRepository.AddAddOns(model);

                if (!string.IsNullOrWhiteSpace(addOnsId))
                {
                    return(Json(new
                    {
                        IsSuccess = true,
                        data = new
                        {
                            AddOnsId = addOnsId
                        }
                    }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(new
                    {
                        IsSuccess = false,
                        errorMessage = "Add Ons details not saved successfully."
                    }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception e)
            {
                Utility.Utility.LogError(e, "Create");
                return(Json(new
                {
                    IsSuccess = false,
                    errorMessage = e.Message
                }));
            }
        }