Exemple #1
0
        public ActionResult Edit(int?id, Entities.RentPayment obj)
        {
            try
            {
                if (id == null)
                {
                    return(RedirectToAction("Index"));
                }

                if (!ModelState.IsValid)
                {
                    return(RedirectToAction("Create")); // View();
                }
                // TODO: Add update logic here
                objRentPayment.Update(obj);

                return(RedirectToAction("Index"));
            }
            catch (Exception exception)
            {
                // log error
                Business.Services.LogError.Insert(exception, (int)Session["UID"]);

                return(View());
            }
        }
        // PUT api/<controller>/5
        public IHttpActionResult Put(Entities.RentPayment objRentPayment)
        {
            if (!ModelState.IsValid)
            {
                return(new BadRequestErrorMessageResult("Error occured during saving data.", null));
            }

            // log active
            Models.LogModels.CreateUserLog("Web Api Put - RentPayment", 1, HttpContext.Current.Request.UserHostAddress);

            var rentPayment = objRentPayment.RentPaymentId > 0 ? iRentPayment.Select(objRentPayment.RentPaymentId) : new Entities.RentPayment();

            rentPayment.Payment     = objRentPayment.Payment;
            rentPayment.PaymentDate = objRentPayment.PaymentDate;
            rentPayment.Active      = objRentPayment.Active;
            rentPayment.Uid         = objRentPayment.Uid;

            if (objRentPayment.RentPaymentId > 0)
            {
                iRentPayment.Update(rentPayment);
            }
            else
            {
                iRentPayment.Insert(rentPayment);
            }

            return(Ok());
        }
Exemple #3
0
        public ActionResult Create(Entities.RentPayment obj)
        {
            try
            {
                // TODO: Add insert logic here
                if (!ModelState.IsValid)
                {
                    return(View());
                }

                objRentPayment.Insert(obj);

                return(RedirectToAction("Index"));
            }
            catch (Exception exception)
            {
                // log error
                Business.Services.LogError.Insert(exception, (int)Session["UID"]);

                return(View());
            }
        }