Example #1
0
        public IActionResult SaveChange(InvoiceDetail model)
        {
            string note   = AppGlobal.InitString;
            int    result = 0;

            if (model.Id > 0)
            {
                model.Initialization(InitType.Update, RequestUserID);
                result = _invoiceDetailResposistory.Update(model.Id, model);
                if (result > 0)
                {
                    note = AppGlobal.Success + " - " + AppGlobal.EditSuccess;
                }
                else
                {
                    note = AppGlobal.Success + " - " + AppGlobal.EditFail;
                }
            }
            else
            {
                model.Initialization(InitType.Insert, RequestUserID);
                result = _invoiceDetailResposistory.Create(model);
                if (result > 0)
                {
                    note = AppGlobal.Success + " - " + AppGlobal.CreateSuccess;
                }
                else
                {
                    note = AppGlobal.Success + " - " + AppGlobal.CreateFail;
                }
            }
            return(Json(note));
        }
        public ActionResult <string> SaveChange(InvoiceDetail model)
        {
            Result routeResult;
            int    result = 0;

            if (model.Id > 0)
            {
                model.Initialization(InitType.Update, RequestUserID);
                result = _invoiceDetailResposistory.Update(model.Id, model);

                if (result > 0)
                {
                    routeResult = new Result()
                                  .setResultType(ResultType.Success)
                                  .setMessage(AppGlobal.EditSuccess);
                }
                else
                {
                    routeResult = new Result()
                                  .setResultType(ResultType.Error)
                                  .setErrorType(ErrorType.EditError)
                                  .setMessage(AppGlobal.EditFail);
                }
            }
            else
            {
                model.Initialization(InitType.Insert, RequestUserID);
                result = _invoiceDetailResposistory.Create(model);

                if (result > 0)
                {
                    routeResult = new Result()
                                  .setResultType(ResultType.Success)
                                  .setMessage(AppGlobal.CreateSuccess);
                }
                else
                {
                    routeResult = new Result()
                                  .setResultType(ResultType.Error)
                                  .setErrorType(ErrorType.InsertError)
                                  .setMessage(AppGlobal.CreateFail);
                }
            }

            return(ObjectToJson(routeResult));
        }
Example #3
0
        public IActionResult Create(InvoiceDetail model)
        {
            string note = AppGlobal.InitString;

            model.Initialization(InitType.Insert, RequestUserID);
            int result = _invoiceDetailResposistory.Create(model);

            if (result > 0)
            {
                note = AppGlobal.Success + " - " + AppGlobal.CreateSuccess;
            }
            else
            {
                note = AppGlobal.Success + " - " + AppGlobal.CreateFail;
            }
            return(Json(note));
        }