Beispiel #1
0
 public void ReferenceDelete(int id)
 {
     if (Convert.ToInt32(Session["RolId"].ToString()) == 1)
     {
         _referenceService.Delete(id);
     }
 }
Beispiel #2
0
        public JsonResult delete(int id)
        {
            var reference = _referenceService.GetById(id);

            _referenceService.Delete(reference);
            return(Json("Referans başarıyla silindi"));
        }
        public async Task <ActionResult <bool> > Delete(Guid id)
        {
            var user = await base.GetUser();

            var reference = await _referenceService.Get(id);

            if (reference == null)
            {
                return(NotFound("Reference with id:" + id));
            }

            if (reference.UserId != user.Id)
            {
                throw new HttpRequestException("Forsøk på å slette referanse oprettet av en annen bruker");
            }

            var result = await _referenceService.Delete(id);

            return(result);
        }
 public ActionResult Delete(int id)
 {
     try
     {
         _referenceService.Delete(id);
         var successModel = new Status()
         {
             StatusCode = 200,
             Message    = "Deleted Successfully"
         };
         return(Ok(successModel));
     }
     catch (Exception ex)
     {
         var errorModel = new Status()
         {
             Message = ex.Message
         };
         Log.Error(ex, ex.Message);
         return(StatusCode(500, errorModel));
     }
 }