Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        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);
        }
Exemple #4
0
 public async Task <IdentityResult> DeleteAsync(IdentityUser user, CancellationToken cancellationToken)
 {
     service.Delete(collection, user.Id);
     return(IdentityResult.Success);
 }
Exemple #5
0
 public async Task <IdentityResult> DeleteAsync(IdentityRole role, CancellationToken cancellationToken)
 {
     service.Delete(collection, role.RoleId);
     return(IdentityResult.Success);
 }
Exemple #6
0
 public async Task <bool> Delete(int id)
 {
     return(await _CRUDService.Delete(id));
 }