Esempio n. 1
0
        /// <summary>
        /// Update Bill Detail
        /// </summary>
        /// <param name="BillDetail">Bill Detail</param>
        /// <exception cref="">ArgumentNullException if Bill Detail is NULL</exception>
        public void UpdateBillDetails(Bill_Detail BillDetail)
        {
            if (BillDetail == null)
            {
                throw new ArgumentNullException();
            }

            _context.Entry <Bill_Detail>(BillDetail).State = System.Data.Entity.EntityState.Modified;

            _context.SaveChanges();
        }
        /// <summary>
        /// Updates existing Department
        /// </summary>
        /// <param name="_dept">Accept Instance of Department</param>
        public void UpdateDepartment(Department _dept)
        {
            if (_dept == null)
            {
                throw new ArgumentNullException("dept");
            }

            _context.Entry <Department>(_dept).State = EntityState.Modified;

            _context.SaveChangesAsync();
        }
        /// <summary>
        /// Update Bill
        /// </summary>
        /// <param name="bill">Bill</param>
        /// <exception cref="">ArgumentNullException If Bill is Null</exception>
        public void UpdateBill(Bill bill)
        {
            if (bill == null)
            {
                throw new ArgumentNullException("context");
            }

            _context.Entry <Bill>(bill).State = System.Data.Entity.EntityState.Modified;

            _context.SaveChanges();
        }
Esempio n. 4
0
        /// <summary>
        /// Update Bill Scan Copy
        /// </summary>
        /// <param name="BillSCopy">Bill Scan Copy</param>
        /// <exception cref="">ArgumentNullException If Bill Scan Copy is Null</exception>
        public void UpdateBillSCopy(Bill_SCopy BillSCopy)
        {
            if (BillSCopy == null)
            {
                throw new ArgumentNullException();
            }

            _context.Entry <Bill_SCopy>(BillSCopy).State = System.Data.Entity.EntityState.Modified;

            _context.SaveChanges();
        }
        public async Task <ActionResult> Edit(EditUserViewModel model)
        {
            if (ModelState.IsValid)
            {
                var Db   = new ApricotContext();
                var user = Db.Users.First(u => u.UserName == model.UserName);
                // Update the user data:
                user.FirstName       = model.FirstName;
                user.LastName        = model.LastName;
                user.Email           = model.Email;
                Db.Entry(user).State = System.Data.Entity.EntityState.Modified;
                await Db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            // If we got this far, something failed, redisplay form
            return(View(model));
        }
Esempio n. 6
0
        /// <summary>
        /// Updates Account
        /// </summary>
        /// <param name="account">Account to be Updated</param>
        /// <returns>True if Account is Updated Successfully, False otherwise i.e (When Duplicate Account Number)</returns>
        /// <exception cref="">ArgumentNUllException if account is NULL</exception>
        public async Task <bool> UpdateAccount(Account account)
        {
            if (account == null)
            {
                throw new ArgumentNullException("account");
            }

            if (!UniqueAccount(account))
            {
                return(false);
            }

            _context.Entry <Account>(account).State = System.Data.Entity.EntityState.Modified;

            await _context.SaveChangesAsync();

            return(true);
        }
Esempio n. 7
0
        public ActionResult Edit(Department model)
        {
            if (ModelState.IsValid)
            {
                var Db         = new ApricotContext();
                var department = Db.Departments.First(dept => dept.Dept_ID == model.Dept_ID);

                // Update the dept data:
                department.Dept_Name       = model.Dept_Name;
                Db.Entry(department).State = System.Data.Entity.EntityState.Modified;
                Db.SaveChanges();

                return(RedirectToAction("Index"));
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
Esempio n. 8
0
        /// <summary>
        /// Update Employee
        /// </summary>
        /// <param name="employee">Employee to Update</param>
        /// <returns>True is Employee is Update Successfully, False Otherwise (i.e. Duplicate Employee Number)</returns>
        /// <exception cref="">ArgumentNullException if employee is NULL</exception>
        public bool UpdateEmployee(Employee employee)
        {
            if (employee == null)
            {
                throw new ArgumentNullException("employee");
            }

            if (!UniqueEmployee(employee))
            {
                return(false);
            }

            _context.Entry <Employee>(employee).State = EntityState.Modified;

            _context.SaveChangesAsync();

            return(true);
        }
 /// <summary>
 /// Update Employee Detail
 /// </summary>
 /// <param name="employeeDetail">Employee Detail</param>
 public void UpdateEmployeeDetail(Employee_Detail employeeDetail)
 {
     _context.Entry <Employee_Detail>(employeeDetail).State = EntityState.Modified;
     _context.SaveChanges();
 }