Example #1
0
 public async Task UpdateASMasterCategory(ASMasterCategory objADMasterCategory)
 {
     try
     {
         _Context.Entry(objADMasterCategory).State = EntityState.Modified;
         await _Context.SaveChangesAsync();
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Example #2
0
 public async Task InsertASMasterCategory(ASMasterCategory objADMasterCategory)
 {
     try
     {
         _Context.ASMasterCategories.Add(objADMasterCategory);
         await _Context.SaveChangesAsync();
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Example #3
0
        public async Task <ActionResult <MasterCategoryResult> > PutASMasterCategory(long id, ASMasterCategory objADMasterCategory)
        {
            _logger.LogError("Done PutASMasterCategory -- Aniruddha Pakhale");

            if (id != objADMasterCategory.MasterCategoryId)
            {
                return(BadRequest());
            }

            try
            {
                await _IMasterCategoryInterface.UpdateASMasterCategory(objADMasterCategory);

                return(_IMasterCategoryInterface.GetASMasterCategoryByID(id));
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!_IMasterCategoryInterface.ASMasterCategoryExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.Message);

                throw new Exception(ex.Message);
            }

            return(NoContent());
        }
Example #4
0
        public async Task <ActionResult <MasterCategoryResult> > PostASMasterCategory(ASMasterCategory objADMasterCategory)
        {
            try
            {
                await _IMasterCategoryInterface.InsertASMasterCategory(objADMasterCategory);

                return(CreatedAtAction("GetASMasterCategory", new { id = objADMasterCategory.MasterCategoryId }, objADMasterCategory));
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.Message);

                throw new Exception(ex.Message);
            }
        }