Example #1
0
        public ActionResult MaterialOutPartySetup(MaterialOutPartyModel model)
        {
            MaterialOutParty materialOutParty = db.MaterialOutParties.Where(a => a.MatOutPartyId.Equals(model.MatOutPartyId)).FirstOrDefault();

            if (materialOutParty == null)
            {
                MaterialOutParty newMaterialOutPartyadd = new MaterialOutParty();
                newMaterialOutPartyadd.Name           = model.Name;
                newMaterialOutPartyadd.OpeningBalance = model.OpeningBalance;
                newMaterialOutPartyadd.CreateDate     = DateTime.Now;
                //newMaterialOutPartyadd.IsActive = model.IsActive;
                newMaterialOutPartyadd.IsActive = true;
                db.MaterialOutParties.Add(newMaterialOutPartyadd);
                db.SaveChanges();
                ModelState.Clear();
                model = null;
                this.AddNotification("Thats great! Successfully Saved.", NotificationType.SUCCESS);
            }
            else
            {
                materialOutParty.Name           = model.Name;
                materialOutParty.OpeningBalance = model.OpeningBalance;
                //materialOutParty.IsActive = model.IsActive;
                materialOutParty.IsActive = true;
                db.SaveChanges();
                model = null;
                this.AddNotification("Thats great! Successfully Edited.", NotificationType.SUCCESS);
            }
            return(RedirectToAction("MaterialOutPartyList"));
        }
Example #2
0
        public ActionResult MaterialOutPartyEditView(int MatOutPartyId)
        {
            MaterialOutPartyModel model     = new MaterialOutPartyModel();
            MaterialOutParty      newFitCat = db.MaterialOutParties.Where(a => a.MatOutPartyId.Equals(MatOutPartyId)).FirstOrDefault();

            if (newFitCat != null)
            {
                model.Name           = newFitCat.Name;
                model.OpeningBalance = newFitCat.OpeningBalance.Value;
                model.IsActive       = newFitCat.IsActive.Value;
            }
            return(View("MaterialOutPartySetup", model));
        }
Example #3
0
        public ActionResult DeleteMaterialOutParty(int MatOutPartyId)
        {
            MaterialOutParty newFitCat = db.MaterialOutParties.Where(a => a.MatOutPartyId.Equals(MatOutPartyId)).FirstOrDefault();

            if (newFitCat != null)
            {
                db.Entry(newFitCat).State = EntityState.Deleted;
                db.SaveChanges();
                ModelState.Clear();
                return(Json(new { success = true, message = "Deleted" }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(new { error = true, message = "Unsuccessfull" }, JsonRequestBehavior.AllowGet));
            }
        }