示例#1
0
        public IActionResult Follow(int id, bool follow)
        {
            var _id      = _currentUser.Id();
            var dealuser = _dealUserServices.Get(a => a.DealId == id && a.UserSettingId == _id);

            if (dealuser == null)
            {
                if (follow)
                {
                    var newData = new DealUser()
                    {
                        DealId = id, UserSettingId = _id, BusinessEntityId = _currentUser.GetCurrentBusinessEntityId()
                    };
                    _dealUserServices.Add(newData);
                }
            }
            else
            {
                if (!follow)
                {
                    _dealUserServices.Delete(dealuser);
                }
            }
            return(RedirectToAction("Edit", new { id = id }));
        }
示例#2
0
        public IActionResult Delete(List <string> ids)
        {
            var result = new PageResultDto();

            try
            {
                List <InterInvite> parm = new List <InterInvite>();
                foreach (var item in ids)
                {
                    parm.Add(new InterInvite {
                        ID = item
                    });
                }
                var i = _services.Delete <InterInvite>(parm);

                result.Code  = i == 0 ? (int)ResultCode.SUCCESS : (int)ResultCode.INTERNAL_SERVER_ERROR;
                result.Count = ids.Count;
                result.Data  = ids;
            }
            catch (Exception ex)
            {
                result.Code = (int)ResultCode.INTERNAL_SERVER_ERROR;
                result.Msg  = "内部操作错误,请联系管理员或查看错误日志。";
                log.Error($"/{System.Reflection.MethodBase.GetCurrentMethod().Name}方法/错误信息:【{ex.Message}】");
            }
            return(Ok(result));
        }
示例#3
0
        public IActionResult Delete(List <string> ids)
        {
            var result = new PageResultDto();

            try
            {
                //string parm =$" '{string.Join("','",ids.ToArray())}'";
                List <RetailBrand> parm = new List <RetailBrand>();
                foreach (var item in ids)
                {
                    parm.Add(new RetailBrand {
                        ID = item
                    });
                }
                var i = _services.Delete <RetailBrand>(parm);
                //直接用dapper执行
                //var i =  _dapper.Execute("delete from retail_brand where id = @id", parm);

                result.Code  = i == 0 ? (int)ResultCode.SUCCESS : (int)ResultCode.INTERNAL_SERVER_ERROR;
                result.Count = ids.Count;
                result.Data  = ids;
            }
            catch (Exception ex)
            {
                result.Code = (int)ResultCode.INTERNAL_SERVER_ERROR;
                result.Msg  = "内部操作错误,请联系管理员或查看错误日志。";
                log.Error($"/{System.Reflection.MethodBase.GetCurrentMethod().Name}方法/错误信息:【{ex.Message}】");
            }
            return(Ok(result));
        }
示例#4
0
        public async Task <JsonResult> RemoveImageAsync(int id)
        {
            var image        = _imageServices.SingleOrDefaultAsync(a => a.ImageId == id).Result;
            var productimage = _productImageServices.SingleOrDefaultAsync(a => a.ImageId == id).Result;

            if (image != null)
            {
                _imageServices.Delete(image, false);
            }

            if (productimage != null)
            {
                _productImageServices.Delete(productimage, false);
            }

            try
            {
                await _context.SaveChangesAsync();

                return(Json(new { ok = "ok" }));
            }
            catch (System.Exception)
            {
                return(Json(new { ok = "nok" }));
            }
        }
示例#5
0
        public IActionResult FollowStage(int dealid, int id, bool follow)
        {
            var _id       = _currentUser.Id();
            var stageuser = _stageUserServices.Get(a => a.StageId == id && a.UserSettingId == _id);

            if (stageuser == null)
            {
                if (follow)
                {
                    var newData = new StageUser()
                    {
                        StageId = id, UserSettingId = _id, BusinessEntityId = _currentUser.GetCurrentBusinessEntityId()
                    };
                    _stageUserServices.Add(newData);
                }
            }
            else
            {
                if (!follow)
                {
                    _stageUserServices.Delete(stageuser);
                }
            }
            return(RedirectToAction("Edit", new { id = dealid }));
        }
示例#6
0
        public async Task <IActionResult> DeleteNote([FromRoute] int id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            await _noteService.Delete(id);

            return(Ok());
        }
示例#7
0
        public async Task <IActionResult> Edit(int id, [Bind("InvoiceId,TaxOperationId,RevisionNumber,InvoiceDate,InvoiceCode,DueDate,ShipDate,Status,OnlineInvoiceFlag,InvoiceNumber,PurchaseOrderNumber,AccountNumber,CustomerId,SalesPersonId,CarrierId,WarehouseId,BillToAddressId,ShipToAddressId,CarrierTrackingNumber,FreightType,Volumes,Package,CarrierTruckId,Weight,TotalWeight,SubTotal,TaxAmt,Freight,TotalDue,Comment,ModifiedDate,BusinessEntityId,OrderQty,ProductId,Finality,InvoiceTp,Number,Sequence,ProductId,Name,Qty,UnitPrice,TaxProduction,TaxSales,CodOper,Discount,Total,CustomerName")] Invoice invoice, List <InvoiceProductModel> product, bool continueAdd, bool addTrash, string CustomerName)
        {
            if (id != invoice.InvoiceId)
            {
                return(NotFound());
            }

            product.RemoveAll(e => e.ProductId == 0);

            ModelState.Clear();
            var validInvoice = TryValidateModel(invoice);
            var validProduct = TryValidateModel(product);



            if (validInvoice)
            {
                //delete any product
                await _invoinceDetailsServices.Query(a => a.InvoiceId == id).ForEachAsync(
                    item => _invoinceDetailsServices.Delete(item, false));

                if (product.Any())
                {
                    invoice.BusinessEntityId = _BusinessId;
                    List <InvoiceDetail> invoiceDetailList = _invoiceExtension.CreateInvoiceDetail(product, null).ToList();
                    invoice.SubTotal = invoiceDetailList.Sum(a => a.LineTotal);
                    invoiceDetailList.ForEach(a => a.InvoiceId = id);
                    invoiceDetailList.ForEach(a => _invoinceDetailsServices.AddAsync(a, false));
                }

                try
                {
                    await _invoiceServices.UpdateAsync(invoice);

                    ErrorMessage = $"Nota Alterada com sucesso: { invoice.Number }";
                    return(continueAdd ? RedirectToAction(nameof(Add)) : RedirectToAction(nameof(List)));
                }
                catch (System.Exception e)
                {
                    ErrorMessage = $"Erro na inclusão da Nota: { e }";
                    return(View(invoice));
                }
            }

            string messages = string.Join("; ", ModelState.Values
                                          .SelectMany(x => x.Errors)
                                          .Select(x => x.ErrorMessage));

            ErrorMessage = $"Nota inválida par alnaçamento: { messages }";
            LoadViewData(id);
            invoice.CustomerName = CustomerName;
            return(View(invoice));
        }
示例#8
0
        public async Task <dynamic> Delete(Guid id, string rev)
        {
            if (_cloudantService != null)
            {
                var response = await _cloudantService.Delete(id, rev);

                Console.WriteLine("DELETE RESULT " + response);

                return(response);
            }

            return(new { });
        }
示例#9
0
        public HttpResponseMessage Delete(int id)
        {
            try
            {
                var staff = staffservice.GetSingle(id);
                staffservice.Delete(staff);
                staffservice.Save();
                return(Request.CreateResponse(HttpStatusCode.OK, "Record has been successfully deleted"));
            }

            catch (Exception ex)
            {
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message));
            }
        }
示例#10
0
        public HttpResponseMessage DeleteVendor(int Id)
        {
            try
            {
                var cat = vendorservice.GetSingle(Id);

                if (cat == null)
                {
                    return(this.Request.CreateResponse(HttpStatusCode.Created, "Invalid VendorId"));
                }

                vendorservice.Delete(cat);
                return(this.Request.CreateResponse(HttpStatusCode.Created, "Deleted Successfully"));
            }
            catch (Exception ex)
            {
                return(this.Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message));
            }
        }
        public HttpResponseMessage DeleteCategory(int Id)
        {
            try
            {
                var cat = categoryservice.GetSingle(Id);

                if (cat == null)
                {
                    return(this.Request.CreateResponse(HttpStatusCode.Created, "Wrong CategoryId"));
                }

                categoryservice.Delete(cat);
                return(this.Request.CreateResponse(HttpStatusCode.Created, "Deleted Successful"));
            }
            catch (Exception ex)
            {
                return(this.Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message));
            }
        }
示例#12
0
 public IActionResult Delete(Address address)
 {
     _addressServices.Delete(address);
     return(RedirectToAction("List"));
 }
示例#13
0
 public IActionResult Delete(StateProvince stateProvince)
 {
     _stateProvinceServices.Delete(stateProvince);
     return(RedirectToAction("List"));
 }
示例#14
0
        public DeleteOrderResponse DeleteOrder(Order order)
        {
            DeleteOrderResponse response = _serv.Delete(order);

            return(response);
        }
示例#15
0
 public IActionResult Delete(City city)
 {
     _cityServices.Delete(city);
     return(RedirectToAction("List"));
 }
 public IActionResult Delete(Territory territory)
 {
     _territoryServices.Delete(territory);
     return(RedirectToAction("List"));
 }
示例#17
0
 public ActionResult DeleteRecord(Student std)
 {
     studentservice.Delete(std);
     return(Json(new { success = true, message = "Deleted Successfully" }, JsonRequestBehavior.AllowGet));
 }