public BranchViewModel AddBranch(BranchViewModel entity)
        {
            var data = new tbl_Branch
            {
                BranchId      = entity.branchId,
                BranchName    = entity.branchName,
                StateId       = entity.stateId,
                CountryId     = entity.countryId,
                BranchAddress = entity.branchAddress,
                ContactPerson = entity.contactPerson,
                PhoneNo       = entity.phoneNo,
                Email         = entity.email,
                IsStore       = entity.isStore,
                IsWarehouse   = entity.isWarehouse,
                IsActive      = entity.isActive,
                CreatedOn     = DateTime.Now,
                CreatedBy     = "admin",
                ModifiedOn    = DateTime.Now,
                ModifiedBy    = "admin"
            };

            context.tbl_Branch.Add(data);
            context.SaveChanges();
            return(entity);
        }
        public ActionResult DeleteConfirmed(int id)
        {
            tbl_Branch tbl_Branch = db.tbl_Branch.Find(id);

            db.tbl_Branch.Remove(tbl_Branch);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "BranchID,BranchName,Street,City,EIRCode")] tbl_Branch tbl_Branch)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tbl_Branch).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tbl_Branch));
 }
        public ActionResult Create([Bind(Include = "BranchID,BranchName,Street,City,EIRCode")] tbl_Branch tbl_Branch)
        {
            if (ModelState.IsValid)
            {
                db.tbl_Branch.Add(tbl_Branch);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(tbl_Branch));
        }
        // GET: tbl_Branch/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tbl_Branch tbl_Branch = db.tbl_Branch.Find(id);

            if (tbl_Branch == null)
            {
                return(HttpNotFound());
            }
            return(View(tbl_Branch));
        }