Beispiel #1
0
        public IActionResult CreateNewValues([FromBody] CommonResourcesCreateModel model)
        {
            var res = _commonResourcesServices.Create(model);

            if (!res.Succeeded)
            {
                return(NotFound());
            }
            return(Ok(res));
        }
Beispiel #2
0
        public IActionResult Delete([FromBody] CommonResourcesCreateModel model)
        {
            var res = _commonResourcesServices.Delete(model);

            if (res != null)
            {
                return(Ok(res));
            }
            return(BadRequest("Delete failed!!"));
        }
 public ApiActionResult Create(CommonResourcesCreateModel model)
 {
     try
     {
         CommonResources obj = new CommonResources();
         obj = _mapper.Map <CommonResources>(model);
         _dbConfigContext.CommonResources.Add(obj);
         var flag = _dbConfigContext.SaveChanges();
         if (flag != 0)
         {
             return(ApiActionResult.Success());
         }
         return(ApiActionResult.Failed("Created Failed!!"));
     }
     catch (Exception ex)
     {
         return(ApiActionResult.Failed(ex.Message));
     }
 }
 public ApiActionResult Delete(CommonResourcesCreateModel model)
 {
     try
     {
         var obj = _dbConfigContext.CommonResources.AsNoTracking().Where(x => x.ResourceKey == model.ResourceKey && x.LanguageFid == model.LanguageFid && x.TypeOfResource == model.TypeOfResource).FirstOrDefault();
         if (obj != null)
         {
             _dbConfigContext.CommonResources.Remove(obj);
             _dbConfigContext.SaveChanges();
             return(ApiActionResult.Success());
         }
         else
         {
             return(ApiActionResult.Failed("Can not find data to delete"));
         }
     }
     catch (Exception ex)
     {
         return(ApiActionResult.Failed(ex.Message));
     }
 }