Beispiel #1
0
        public ActionResult Index(Point model, FormCollection form)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    string statusDDLValue = form["Statusddl"].ToString();

                    //var clientId= entity.InsertUpdateSelectAdmin(0, model.name, model.Address, model.MobileNo, model.EmailId, genderDDLValue, model.dob, model.countryId, model.stateId, model.cityId, 1, );
                    using (var context = new LoyaltyManagementSystemEntities())
                    {
                        var points = new LMS_Datas.Point()
                        {
                            Points = model.Points,
                            Amount = model.Amount,
                            Active = Boolean.Parse(statusDDLValue)
                        };
                        context.Points.Add(points);

                        //context.ClientDetails.Add(clientDetails);
                        //etc add your other classes
                        context.SaveChanges();
                    }
                    ViewBag.alert = "Success";
                    return(View());
                }
                ViewBag.alert = "Error";
                return(View(model));
            }
            catch (Exception e1)
            {
                ViewBag.alert = "Error";
                return(View());
            }
        }
Beispiel #2
0
        public string EditPackage(Point Model)
        {
            string msgClient;

            try
            {
                if (ModelState.IsValid)
                {
                    var enditedPointsValue = new LMS_Datas.Point
                    {
                        Active   = true,
                        Points   = Model.Points,
                        Amount   = Model.Amount,
                        PointsId = Model.PointsId
                    };

                    entity.Points.Attach(enditedPointsValue);
                    entity.Entry(enditedPointsValue).Property(x => x.Active).IsModified   = true;
                    entity.Entry(enditedPointsValue).Property(x => x.Points).IsModified   = true;
                    entity.Entry(enditedPointsValue).Property(x => x.PointsId).IsModified = true;
                    entity.Entry(enditedPointsValue).Property(x => x.Amount).IsModified   = true;
                    //entity.Entry(enditedPackageValue).State = EntityState.Modified;
                    entity.SaveChanges();
                    msgClient = "Saved Successfully";
                }
                else
                {
                    msgClient = "Validation data not successfully";
                }
            }
            catch (Exception ex)
            {
                msgClient = "Error in Retriving Data";
            }
            return(msgClient);
        }