public ActionResult Create(List <PurchaseReportVM> prakashanreport, FormCollection col)
        {
            DateTime date    = Convert.ToDateTime(col["EnglishDate"]);
            string   Nepdate = col["NepaliDate"].ToString();
            var      report  = db.prakashanreports.FirstOrDefault(m => m.Date == date);

            if (report == null)
            {
                PurchaseReportVM purchasevm = new PurchaseReportVM();
                foreach (var item in prakashanreport)
                {
                    Prakashanreport objreport = new Prakashanreport();
                    objreport.NepaliDate     = Nepdate;
                    objreport.Date           = date;
                    objreport.GroupId        = Convert.ToInt32(item.GroupId);
                    objreport.PrakashanGroup = db.prakashanGroups.Find(objreport.GroupId);
                    objreport.gp_Total       = item.gp_Total;
                    objreport.rn_Total       = item.rn_Total;
                    objreport.Remarks        = item.Remarks;
                    db.prakashanreports.Add(objreport);
                    db.SaveChanges();
                }
                TempData["message"] = "Production record inserted sucessfully";
                log.AddActivity("Production report Successfully Inserted");
                return(RedirectToAction("Index"));
            }
            else
            {
                TempData["message"] = " Production Record for this date is already stored please edit this record here";
                return(RedirectToAction("EditByDate"));
            }
        }
        public ActionResult DeleteConfirmed(int id)
        {
            Prakashanreport prakashanreport = db.prakashanreports.Find(id);

            db.prakashanreports.Remove(prakashanreport);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        // GET: Prakashanreports/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Prakashanreport prakashanreport = db.prakashanreports.Find(id);

            if (prakashanreport == null)
            {
                return(HttpNotFound());
            }
            return(View(prakashanreport));
        }
Ejemplo n.º 4
0
        public ActionResult Edit(List <PurchaseReportVM> prakashanreport)
        {
            if (ModelState.IsValid)
            {
                PurchaseReportVM purchasevm = new PurchaseReportVM();
                foreach (var item in prakashanreport)
                {
                    Prakashanreport objreport = db.prakashanreports.Find(item.Edit_ID);


                    objreport.gp_Total = item.gp_Total;
                    objreport.rn_Total = item.rn_Total;
                    objreport.Remarks  = item.Remarks;

                    db.SaveChanges();
                }
                TempData["message"] = "Production Report is Sucessfully Edited";
                return(RedirectToAction("Index"));
            }
            return(View(prakashanreport));
        }