Example #1
0
        /// <summary>
        /// Insert or Update in tbl_Location table -vinod
        /// </summary>
        /// <param name="Sub Category"></param>
        /// <returns></returns>
        public string InsertOrUpdate(SubCategoryModel SCM)
        {
            string          result  = string.Empty;
            bool            isExist = false;
            tbl_SubCategory subcategory;

            subcategory = this.GetByID(SCM.SubCategoryID.Trim());
            if (subcategory != null)
            {
                isExist = true;
            }
            else
            {
                subcategory = new tbl_SubCategory();
            }
            subcategory.CategoryID      = SCM.CategoryID;
            subcategory.SubCategoryID   = SCM.SubCategoryID;
            subcategory.SubCategoryDesc = SCM.SubCategoryDesc;
            if (!isExist)
            {
                return(result = this.Insert(subcategory));
            }
            else
            {
                return(result = this.Update(subcategory));
            }
        }
Example #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            tbl_SubCategory tbl_SubCategory = db.tbl_SubCategory.Find(id);

            db.tbl_SubCategory.Remove(tbl_SubCategory);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #3
0
        public string InsertOrUpdateSubCategory(SubCategoryModel SCM)
        {
            tbl_SubCategory subcategory = new tbl_SubCategory();

            subcategory.CategoryID      = SCM.CategoryID;
            subcategory.SubCategoryID   = SCM.SubCategoryID;
            subcategory.SubCategoryDesc = SCM.SubCategoryDesc;
            return(SubCategoryBL.InsertOrUpdate(SCM));
        }
Example #4
0
 public ActionResult Edit([Bind(Include = "subcategoryid,subcategoryname,FKcategoryid")] tbl_SubCategory tbl_SubCategory)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tbl_SubCategory).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.FKcategoryid = new SelectList(db.tbl_Category, "categoryid", "categoryname", tbl_SubCategory.FKcategoryid);
     return(View(tbl_SubCategory));
 }
Example #5
0
        // GET: Administrator/SubCategory/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tbl_SubCategory tbl_SubCategory = db.tbl_SubCategory.Find(id);

            if (tbl_SubCategory == null)
            {
                return(HttpNotFound());
            }
            return(View(tbl_SubCategory));
        }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        d = new DataClassesDataContext();
        tbl_SubCategory s = new tbl_SubCategory();

        s.Scatname = txtName.Text;
        s.desc     = txtDesc.Text;
        s.pid      = int.Parse(DDLPCat.SelectedValue.ToString());
        s.dateon   = DateTime.Now;
        d.tbl_SubCategories.InsertOnSubmit(s);
        d.SubmitChanges();
        Response.Write("<script>alert('Sub Category Added Successfully')</script>");
        show();
    }
Example #7
0
        // GET: Administrator/SubCategory/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tbl_SubCategory tbl_SubCategory = db.tbl_SubCategory.Find(id);

            if (tbl_SubCategory == null)
            {
                return(HttpNotFound());
            }
            ViewBag.FKcategoryid = new SelectList(db.tbl_Category, "categoryid", "categoryname", tbl_SubCategory.FKcategoryid);
            return(View(tbl_SubCategory));
        }
Example #8
0
        /// <summary>
        /// Get Location details By ID -Srikanth
        /// </summary>
        /// <param name="locationID"></param>
        /// <returns></returns>
        public PartialViewResult GetSubCategoryByID(string SubCategoryID)
        {
            SubCategoryModel SCM = new SubCategoryModel();
            tbl_SubCategory  subcategory;

            SCM         = SubCategoryBL.SubCategoryM();
            subcategory = SubCategoryBL.GetByID(SubCategoryID.Trim());

            if (subcategory == null)
            {
                subcategory = new tbl_SubCategory();
            }
            SCM.CategoryID      = subcategory.CategoryID;
            SCM.SubCategoryID   = subcategory.SubCategoryID;
            SCM.SubCategoryDesc = subcategory.SubCategoryDesc;
            return(PartialView("~/Views/SubCategory/Partial/_SubCategoryDetailsPartial.cshtml", SCM));
        }
Example #9
0
        /// <summary>
        /// Update Sub Category
        /// </summary>
        /// <param name="category"></param>
        /// <returns></returns>
        public string Update(tbl_SubCategory subcategory)
        {
            try
            {
                Context.SubCategory.Update(subcategory);
                Context.SubCategory.Save();
                return(subcategory.SubCategoryID + " Updated Successfully!!");
            }
            catch (Exception ex)
            {
                //POS Log Exception to db table

                return("Error in saving details, Please try again!!");
            }
            finally
            {
                // Context = null;
            }
        }