Exemple #1
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            KT_CPUE t = await db.KT_CPUE.FindAsync(id);


            db.KT_CPUE.Remove(t);

            await db.SaveChangesAsync();

            this.Information(string.Format(FDB.Common.Constants.NOTIFY_DELETE_SUCCESS, "Phỏng vấn sản lượng"));

            return(Json(new { success = true }));
        }
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            KT_NGAYHOATDONG t = await db.KT_NGAYHOATDONG.FindAsync(id);


            db.KT_NGAYHOATDONG.Remove(t);

            await db.SaveChangesAsync();

            this.Information(string.Format(FDB.Common.Constants.NOTIFY_DELETE_SUCCESS, "Ngày hoạt động tiềm năng"));

            return(Json(new { success = true }));
        }
        public ActionResult RegisterRestorana(Restoran restoran)
        {
            restoran.VlasnikId = Session["VlasnikId"].ToString();


            if (ModelState.IsValidField("RestId") && ModelState.IsValidField("ImeRest") && ModelState.IsValidField("Ulica") && ModelState.IsValidField("email") && ModelState.IsValidField("Passw"))
            {
                Restoran r = new Restoran();
                r.RestId    = restoran.RestId;
                r.ImeRest   = restoran.ImeRest;
                r.PostBroj  = restoran.PostBroj;
                r.Ulica     = restoran.Ulica;
                r.email     = restoran.email;
                r.Passw     = restoran.Passw;
                r.KucniBroj = restoran.KucniBroj;
                r.Telefon   = restoran.Telefon;
                r.Mobitel   = restoran.Mobitel;
                r.KvartId   = restoran.KvartId;
                r.VlasnikId = restoran.VlasnikId;

                Session["VlasnikId"] = null;

                Rating rat = new Rating();
                rat.RestId = restoran.RestId;
                rat.jedna  = 0;
                rat.dvije  = 0;
                rat.tri    = 0;
                rat.cetiri = 0;
                rat.pet    = 0;
                rat.ocjena = 1.0;


                fdb.Restoran.Add(r);
                fdb.Rating.Add(rat);
                fdb.SaveChangesAsync();
                Session["VlasnikId"] = null;
                Session["RestReg"]   = "Uspješno ste registrirali restoran " + restoran.ImeRest.ToString();
                return(RedirectToAction("RegisterRestorana"));
            }
            ModelState.Clear();

            var v = fdb.Vlasnik.Find(Session["VlasnikId"].ToString());

            fdb.Vlasnik.Remove(v);
            fdb.SaveChanges();
            Session["VlasnikId"] = null;
            ViewBag.restMessage  = "Krivo ste unijeli podatke.";
            return(RedirectToAction("RegisterRestorana"));
        }