public RestMessage <bool> Delete(string collection, string id) { RestMessage <bool> response = new RestMessage <bool>(false); try { bool result = service.Delete(collection, id); response.Data = true; return(response); } catch (ValidationException err) { response.Errors = err.Errors; } catch (Exception untrapped) { //TODO: log here response.Errors.Add(new Library.Core.Error() { Code = "UNEXPEXTED", Title = $"{collection} produces an unexpexted error", Description = untrapped.Message, }); } return(response); }
public HttpResponseMessage Delete([FromBody] Aplikacija aplikacija) { CRUDService service = new CRUDService(); HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK); Entities db = new Entities(); try { service.Delete(aplikacija, db.Aplikacijas); } catch (ApplicationException ex) { response = Request.CreateResponse(HttpStatusCode.InternalServerError, ex); } return(response); }
public HttpResponseMessage Delete([FromBody] DVlogePravice dVlogePravice) { CRUDService service = new CRUDService(); HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK); Entities db = new Entities(); try { service.Delete(CRUDService.ParsePravice(dVlogePravice), db.Pravices); } catch (ApplicationException ex) { response = Request.CreateResponse(HttpStatusCode.InternalServerError, ex); } return(response); }
public async Task <IdentityResult> DeleteAsync(IdentityUser user, CancellationToken cancellationToken) { service.Delete(collection, user.Id); return(IdentityResult.Success); }
public async Task <IdentityResult> DeleteAsync(IdentityRole role, CancellationToken cancellationToken) { service.Delete(collection, role.RoleId); return(IdentityResult.Success); }
public async Task <bool> Delete(int id) { return(await _CRUDService.Delete(id)); }