public HttpResponseMessage Delete(InvoiceDeleteModel invoicesDeleteModel)
        {
            InvoiceDto invoicesDto = this.mapper.Map <InvoiceDeleteModel, InvoiceDto>(invoicesDeleteModel);

            this.invoicesAppService.RemoveExistingInvoice(invoicesDto);

            return(new HttpResponseMessage(HttpStatusCode.OK));
        }
示例#2
0
 public InvoiceDeleteRequest(InvoiceDeleteModel model) : this()
 {
     Id               = model.Id;
     RecordNo         = model.RecordNo;
     RecordDate       = model.RecordDate.ConvertToString();
     Reason           = model.Reason;
     FileNameOfRecord = model.FileNameOfRecord;
     FileOfRecord     = model.FileOfRecord;
 }
示例#3
0
 public bool CallDelete(InvoiceDeleteModel model)
 {
     try
     {
         _httpClient.PostJson <InvoiceDeleteModel, string>(_pgClient.ServiceUrl, $"api/v2/crmobject/invoice/purchase/delete", _pgClient.Ticket, model);
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
示例#4
0
        /// <summary>
        ///     Xóa 1 hóa đơn đã ký.
        ///     Nếu hóa đơn chưa báo cáo, hệ thống đưa hóa đơn về trạng thái Hủy bỏ
        ///     Nếu hóa đơn đã keek hai, báo cáo, hệ thống sẽ tạo hóa đơn điều chỉnh giảm cho hóa đơn này
        /// </summary>
        /// <param name="authentication"></param>
        /// <param name="model"></param>
        /// <returns></returns>
        public MessageResult Delete(Authentication authentication,
                                    InvoiceDeleteModel model)
        {
            MessageResult result = new MessageResult();

            try
            {
                var token = GetToken(authentication);

                if (!string.IsNullOrEmpty(token))
                {
                    string apiLink = $"{authentication.DomainName}/api/invoices/delete/{model.Id}";

                    InvoiceDeleteRequest request = new InvoiceDeleteRequest(model);

                    var rawResponse = AppUtil.CreateRequest(apiLink,
                                                            request.ToJson(),
                                                            token);
                    var response = rawResponse.ToObject <BaseResponse <InvoiceDeleteResponse> >();
                    if (response != null)
                    {
                        result.Code      = response.Code;
                        result.Succeeded = response.Succeeded;
                        result.Data      = response.Data;
                    }
                }
                else
                {
                    result.CannotLogin();
                }
            }
            catch (Exception)
            {
                result.ErrorApi();
            }

            return(result);
        }