예제 #1
0
        public JsonResult Edit(Transport model)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(Json(new { Result = "ERROR", Message = "Form is not valid! Please correct it and try again." }));
                }

                Transport itemFound = TransportManager.GetById(model.kTransportId);
                if (itemFound == null)
                {
                    return(Json(new { Result = "ERROR", Message = "Item Not Found" }));
                }

                /*---- bind exists data -------------------------------------*/
                model.dtDateAdd    = itemFound.dtDateAdd;
                model.dtDateUpdate = DateTime.Now;
                /*----------------------------------------------------------*/

                TransportManager.Edit(model);
                return(Json(new { Result = "OK" }));
            }
            catch (Exception ex)
            {
                return(Json(new { Result = "ERROR", Message = ex.Message }));
            }
        }