예제 #1
0
        public ActionResult Edit(CreateTrosakView ct)
        {
            //ct.Trosak.KategorijaID = int.Parse(ct.Kategorije[0].Value);
            //db.Entry(ct.Trosak).State = System.Data.EntityState.Modified;
            //db.SaveChanges();
            Repozitorij.UpdateTrosak(ct.Trosak);

            return RedirectToAction("Index");
        }
예제 #2
0
        public ActionResult CreateTrosak(CreateTrosakView cpt, String submit)
        {
            if (ModelState.IsValid)
            {

                //dodajem UserID na trosak
                cpt.Trosak.UserId = WebSecurity.CurrentUserId;
                cpt.Trosak.ValutaID = 1; //HR
                cpt.Trosak.Aktivno = true;
                cpt.Trosak.KategorijaID = cpt.Trosak.Kategorija.IDKategorija;

                //cpt.Trosak.DatumVrijeme.ge

                Repozitorij.SpremiTrosak(cpt.Trosak);

                switch (submit)
                {
                    case "finished":
                        return View("Index");
                    case "notFinished":
                        CreateTrosakView cptNew = new CreateTrosakView();
                        ModelState.Clear();
                        return View(cptNew);
                    default:
                        break;
                }
            }

            CreateTrosakView cptErr = new CreateTrosakView();
            return View(cptErr);
        }
예제 #3
0
 public ActionResult CreateTrosak()
 {
     CreateTrosakView ptv = new CreateTrosakView();
     return View("CreateTrosak", ptv);
 }
예제 #4
0
 public ActionResult Edit(int? idTrosak)
 {
     CreateTrosakView ct = new CreateTrosakView();
     ct.Trosak = db.PrihodTrosak.Find(idTrosak);
     return View("Edit", ct);
 }