Exemple #1
0
        public ActionResult Create(ServiceTaxCategory vm)
        {
            ServiceTaxCategory pt = vm;

            if (ModelState.IsValid)
            {
                pt.CreatedDate  = DateTime.Now;
                pt.ModifiedDate = DateTime.Now;
                pt.CreatedBy    = User.Identity.Name;
                pt.ModifiedBy   = User.Identity.Name;
                pt.ObjectState  = Model.ObjectState.Added;
                _ServiceTaxCategoryService.Create(pt);

                try
                {
                    _unitOfWork.Save();
                }

                catch (Exception ex)
                {
                    string message = _exception.HandleException(ex);
                    ModelState.AddModelError("", message);
                    return(View("Create", vm));
                }


                return(RedirectToAction("Create").Success("Data saved successfully"));
            }
            return(View("Create", vm));
        }
Exemple #2
0
        public ActionResult Edit(ServiceTaxCategory pt)
        {
            if (ModelState.IsValid)
            {
                ServiceTaxCategory temp = _ServiceTaxCategoryService.Find(pt.ServiceTaxCategoryId);

                temp.ServiceTaxCategoryName = pt.ServiceTaxCategoryName;
                temp.ModifiedDate           = DateTime.Now;
                temp.ModifiedBy             = User.Identity.Name;
                temp.ObjectState            = Model.ObjectState.Modified;
                _ServiceTaxCategoryService.Update(temp);

                try
                {
                    _unitOfWork.Save();
                }

                catch (Exception ex)
                {
                    string message = _exception.HandleException(ex);
                    ModelState.AddModelError("", message);
                    return(View("Create", pt));
                }


                return(RedirectToAction("Index").Success("Data saved successfully"));
            }
            return(View("Create", pt));
        }
Exemple #3
0
        // GET: /ProductMaster/Edit/5

        public ActionResult Edit(int id)
        {
            ServiceTaxCategory pt = _ServiceTaxCategoryService.GetServiceTaxCategory(id);

            if (pt == null)
            {
                return(HttpNotFound());
            }
            return(View("Create", pt));
        }
Exemple #4
0
        // GET: /ProductMaster/Delete/5

        public ActionResult Delete(int id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ServiceTaxCategory ServiceTaxCategory = _ServiceTaxCategoryService.GetServiceTaxCategory(id);

            if (ServiceTaxCategory == null)
            {
                return(HttpNotFound());
            }

            ReasonViewModel vm = new ReasonViewModel()
            {
                id = id,
            };

            return(PartialView("_Reason", vm));
        }
 public void Update(ServiceTaxCategory pt)
 {
     pt.ObjectState = ObjectState.Modified;
     _unitOfWork.Repository <ServiceTaxCategory>().Update(pt);
 }
 public void Delete(ServiceTaxCategory pt)
 {
     _unitOfWork.Repository <ServiceTaxCategory>().Delete(pt);
 }
 public ServiceTaxCategory Create(ServiceTaxCategory pt)
 {
     pt.ObjectState = ObjectState.Added;
     _unitOfWork.Repository <ServiceTaxCategory>().Insert(pt);
     return(pt);
 }
 public ServiceTaxCategory Add(ServiceTaxCategory pt)
 {
     _unitOfWork.Repository <ServiceTaxCategory>().Insert(pt);
     return(pt);
 }
Exemple #9
0
        // GET: /ProductMaster/Create

        public ActionResult Create()
        {
            ServiceTaxCategory vm = new ServiceTaxCategory();

            return(View("Create", vm));
        }