Exemple #1
0
        public ActionResult Create([Bind(Include = "Id,Name,PhoneNo")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                db.Employees.Add(employee);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(employee));
        }
Exemple #2
0
        public ActionResult Create([Bind(Include = "Id,Name,Code")] GeneralCategory generalcategory)
        {
            if (ModelState.IsValid)
            {
                db.GeneralCategories.Add(generalcategory);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(generalcategory));
        }
Exemple #3
0
        public ActionResult Create([Bind(Include = "Id,Name,Code,Location")] Organization organization)
        {
            if (ModelState.IsValid)
            {
                db.Organizations.Add(organization);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(organization));
        }
Exemple #4
0
        public ActionResult Create([Bind(Include = "Id,Name,Code,Price,SerialNo,Description,SubCategoryId")] Asset asset)
        {
            if (ModelState.IsValid)
            {
                db.Assets.Add(asset);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.SubCategoryId = new SelectList(db.SubCategories, "Id", "Name", asset.SubCategoryId);
            return(View(asset));
        }
        public ActionResult Create([Bind(Include = "Id,Name,ShortName,OrganizationId")] OrganizationBranch organizationbranch)
        {
            if (ModelState.IsValid)
            {
                db.OrganizationBranches.Add(organizationbranch);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.OrganizationId = new SelectList(db.Organizations, "Id", "Name", organizationbranch.OrganizationId);
            return(View(organizationbranch));
        }
        public ActionResult Create([Bind(Include = "Id,Name,Code,GeneralCategoryId")] Category category)
        {
            if (ModelState.IsValid)
            {
                db.Categories.Add(category);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.GeneralCategoryId = new SelectList(db.GeneralCategories, "Id", "Name", category.GeneralCategoryId);
            return(View(category));
        }
Exemple #7
0
        public ActionResult Create([Bind(Include = "Id,Name,ShortName,OrganizationBranchId")] AssetLocation assetlocation)
        {
            if (ModelState.IsValid)
            {
                db.AssetLocations.Add(assetlocation);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.OrganizationBranchId = new SelectList(db.OrganizationBranches, "Id", "Name", assetlocation.OrganizationBranchId);
            return(View(assetlocation));
        }
        public ActionResult Create([Bind(Include = "Id,AssetId,OrganizationId,SerialNo,RegistrationCode,Code,AssetLocationId,EmployeeId")] AssetRegistration assetregistration)
        {
            if (ModelState.IsValid)
            {
                db.AssetRegistrations.Add(assetregistration);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.AssetId         = new SelectList(db.Assets, "Id", "Name", assetregistration.AssetId);
            ViewBag.AssetLocationId = new SelectList(db.AssetLocations, "Id", "Name", assetregistration.AssetLocationId);
            ViewBag.EmployeeId      = new SelectList(db.Employees, "Id", "Name", assetregistration.EmployeeId);
            ViewBag.OrganizationId  = new SelectList(db.Organizations, "Id", "Name", assetregistration.OrganizationId);
            return(View(assetregistration));
        }
 public bool Add(Department department)
 {
     AssetDBContext db = new AssetDBContext();
     db.Departments.Add(department);
     int rowAffected = db.SaveChanges();
     return rowAffected > 0;
 }
 public bool Update(Department  department)
 {
     AssetDBContext db = new AssetDBContext();
     db.Departments.Attach(department);
     db.Entry(department).State = EntityState.Modified;
     int rowAffected = db.SaveChanges();
     return rowAffected > 0;
 }
        public bool Add(Location location)
        {
            AssetDBContext db = new AssetDBContext();

            db.Locations.Add(location);
            int rowAffected = db.SaveChanges();

            return(rowAffected > 0);
        }
        public bool Add(GeneralCategory generalCategory)
        {
            AssetDBContext db = new AssetDBContext();

            db.GeneralCategories.Add(generalCategory);
            int rowAffected = db.SaveChanges();

            return(rowAffected > 0);
        }
        public bool Add(Vendor vendor)
        {
            AssetDBContext db = new AssetDBContext();

            db.Vendors.Add(vendor);
            int rowAffected = db.SaveChanges();

            return(rowAffected > 0);
        }
Exemple #14
0
        public bool Add(Category category)
        {
            AssetDBContext db = new AssetDBContext();

            db.Categories.Add(category);
            int rowAffected = db.SaveChanges();

            return(rowAffected > 0);
        }
Exemple #15
0
        public bool Add(OrganizationBranch organizationBranch)
        {
            AssetDBContext db = new AssetDBContext();

            db.OrganizationBranches.Add(organizationBranch);
            int rowAffacted = db.SaveChanges();

            return(rowAffacted > 0);
        }
        public bool Add(Employee employee)
        {
            AssetDBContext db = new AssetDBContext();

            db.Employees.Add(employee);
            int rowAffected = db.SaveChanges();

            return(rowAffected > 0);
        }
Exemple #17
0
        public ActionResult Entry(OrganizationBranch organizationBranch)
        {
            AssetDBContext context = new AssetDBContext();

            context.OrganizationBranches.Add(organizationBranch);
            int rowAffected = context.SaveChanges();

            return(RedirectToAction("Entry"));
        }
        public bool Update(GeneralCategory generalCategory)
        {
            AssetDBContext db = new AssetDBContext();

            db.GeneralCategories.Attach(generalCategory);
            db.Entry(generalCategory).State = EntityState.Modified;
            int rowAffected = db.SaveChanges();

            return(rowAffected > 0);
        }
Exemple #19
0
        public bool Add(Organization organization)
        {
            AssetDBContext db = new AssetDBContext();

            db.Organizations.Add(organization);

            int rowAffected = db.SaveChanges();

            return(rowAffected > 0);
        }
        public bool Update(Employee employee)
        {
            AssetDBContext db = new AssetDBContext();

            db.Employees.Attach(employee);
            db.Entry(employee).State = EntityState.Modified;
            int rowAffected = db.SaveChanges();

            return(rowAffected > 0);
        }
        public bool Update(Location location)
        {
            AssetDBContext db = new AssetDBContext();

            db.Locations.Attach(location);
            db.Entry(location).State = EntityState.Modified;
            int rowAffected = db.SaveChanges();

            return(rowAffected > 0);
        }
Exemple #22
0
        public bool Update(Category category)
        {
            AssetDBContext db = new AssetDBContext();

            db.Categories.Attach(category);
            db.Entry(category).State = EntityState.Modified;
            int rowAffacted = db.SaveChanges();

            return(rowAffacted > 0);
        }
Exemple #23
0
        public bool Update(OrganizationBranch organizationBranch)
        {
            AssetDBContext db = new AssetDBContext();

            db.OrganizationBranches.Attach(organizationBranch);
            db.Entry(organizationBranch).State = EntityState.Modified;
            int rowAffacted = db.SaveChanges();

            return(rowAffacted > 0);
        }
        public bool Update(Vendor vendor)
        {
            AssetDBContext db = new AssetDBContext();

            db.Vendors.Attach(vendor);
            db.Entry(vendor).State = EntityState.Modified;
            int rowAffacted = db.SaveChanges();

            return(rowAffacted > 0);
        }