Esempio n. 1
0
        public ActionResult Action(tblCustomer objSubmit)
        {
            if (objSubmit.ID == 0)
            {
                objSubmit.DateCreated = DateTime.Now;
                objSubmit.DateUpdated = DateTime.Now;
                objSubmit.IsDeleted = false;
                objSubmit.IsActive = true;
                customerRepository.Add(objSubmit);
            }
            else
            {
                var obj = customerRepository.GetById<tblCustomer>(objSubmit.ID);

                UpdateModel(obj);

                objSubmit.DateUpdated = DateTime.Now;

                customerRepository.Update(obj);
            }

            return Json(new
            {
                Error = false
            }, JsonRequestBehavior.AllowGet);
        }
Esempio n. 2
0
        public bool AddCustomer(out int customerId, tblCustomer customer)
        {
            customerId = 0;

            var isCheck = web365db.tblCustomer.Count(c => c.Email == customer.Email && c.IsActive == true) > 0;

            if (isCheck)
            {
                return isCheck;
            }

            customer.Password = Web365Utility.Web365Utility.MD5Hash(customer.Password);
            customer.DateCreated = DateTime.Now;
            customer.DateUpdated = DateTime.Now;
            customer.IsActive = true;
            customer.IsDeleted = false;

            web365db.tblCustomer.Add(customer);

            var result = web365db.SaveChanges();

            customerId = customer.ID;

            return result > 0;
        }