Exemplo n.º 1
0
        public IActionResult Createsueeper(SueeperModel model)

        {
            if (ModelState.IsValid)
            {
                try
                {
                    Sueeper tbl      = new Sueeper();
                    var     checktbl = db.SueeperInfo.Where(m => m.Id == tbl.Id).FirstOrDefault();
                    if (checktbl == null)
                    {
                        tbl.Name                          = model.Name;
                        tbl.Password                      = model.Password;
                        tbl.Phone                         = model.Phone;
                        tbl.Socialsecuritynumber          = model.Socialsecuritynumber;
                        tbl.Zipcode                       = model.Zipcode;
                        tbl.IsBusy                        = "Availble";
                        tbl.Can_you_buy_cleaning_products = model.Can_you_buy_cleaning_products;
                        tbl.Do_you_have_car               = model.Do_you_have_car;
                        tbl.Email                         = model.Email;
                        tbl.val = "1";
                        db.SueeperInfo.Add(tbl);
                        db.SaveChanges();
                        ModelState.Clear();
                        ViewBag.Message = "New Sueeper Created";
                        return(View());
                    }
                    else
                    {
                        tbl.Name                          = model.Name;
                        tbl.Password                      = model.Password;
                        tbl.Phone                         = model.Phone;
                        tbl.Socialsecuritynumber          = model.Socialsecuritynumber;
                        tbl.IsBusy                        = "Availble";
                        tbl.Can_you_buy_cleaning_products = model.Can_you_buy_cleaning_products;
                        tbl.Do_you_have_car               = model.Do_you_have_car;
                        tbl.Email                         = model.Email;
                        db.SaveChanges();
                    }
                }
                catch (Exception ex)
                {
                }
            }
            return(View());
        }
Exemplo n.º 2
0
        public IActionResult Edit(SueeperModel model)
        {
            if (ModelState.IsValid)
            {
                Sueeper tble     = new Sueeper();
                var     editdata = db.SueeperInfo.Where(m => m.Id == model.id).FirstOrDefault();
                editdata.Name  = model.Name;
                editdata.Phone = model.Phone;
                editdata.Socialsecuritynumber = model.Socialsecuritynumber;
                editdata.Zipcode         = model.Zipcode;
                editdata.Do_you_have_car = model.Do_you_have_car;
                editdata.Email           = model.Email;
                db.SaveChanges();

                return(RedirectToAction("Index"));
            }
            return(View());
        }