public JsonResult Delete(string advertisementId) { try { string funcId = PermissionEnum.CodeFormat((int)PermissionEnum.扩展管理.广告管理.除); if (!IsPermission(funcId)) { return(Error("您没有操作权限,请联系系统管理员!")); } var result = AdvertisementService.DeleteAdvertisement(SystemID, CompanyID, advertisementId); if (result) { return(Success("ok")); } else { return(Error("fail")); } } catch (Exception ex) { return(Error(ex.Message)); } }
public ActionResult Delete(int id) { var advertise = _advertisementService.GetAdvertisementById(id); if (advertise == null) { return(RedirectToAction("List")); } advertise.UpdatedOnUtc = DateTime.UtcNow; advertise.Deleted = true; _advertisementService.DeleteAdvertisement(advertise); return(RedirectToAction("List")); }
public IActionResult Delete(int id) { var token = HttpContext.Session.GetString("agentId"); if (string.IsNullOrEmpty(token)) { return(RedirectToAction("Index", "Login")); } _advertisementService.DeleteAdvertisement(id); return(RedirectToAction("Index", "Home")); }
public async Task <HttpResponseMessage> Add(HttpRequestMessage request, long id) { try { await _advertisementService.DeleteAdvertisement(id); return(request.CreateResponse(HttpStatusCode.OK)); } catch (Exception ex) { return(request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message)); } }
public async Task <IActionResult> Delete(int id, [FromQuery] string reason) { var userId = await GetCurrentUserId(); var result = await _advertisementService.DeleteAdvertisement(userId, id, reason); if (result.IsSuccessful) { return(Ok()); } if (result.IsClientError) { return(Forbid()); } return(StatusCode(500)); }
public async Task <HttpResponseMessage> DeleteAdvertisement([FromUri] Guid advertUid) { await _advertisementService.DeleteAdvertisement(advertUid); return(new HttpResponseMessage(HttpStatusCode.OK)); }
public IActionResult DeleteConfirmed(long id) { advertisementservice.DeleteAdvertisement(id); advertisementservice.SaveAdvertisement(); return(RedirectToAction("Index")); }