public async Task <ActionResult <TblCategoryMaster> > PostTblCategoryMaster(TblCategoryMaster tblCategoryMaster) { _context.TblCategoryMaster.Add(tblCategoryMaster); await _context.SaveChangesAsync(); return(CreatedAtAction("GetTblCategoryMaster", new { id = tblCategoryMaster.Id }, tblCategoryMaster)); }
public async Task <IActionResult> PutTblCategoryMaster(long id, TblCategoryMaster tblCategoryMaster) { if (id != tblCategoryMaster.Id) { return(BadRequest()); } _context.Entry(tblCategoryMaster).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TblCategoryMasterExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <ApiResponse> > GetCategoryById(TblCategoryMaster tblCategoryObj) { var tblCategoryMaster = await _context.TblCategoryMaster.FindAsync(tblCategoryObj.Id); var ApiResponse = await response.ApiResult("OK", tblCategoryMaster, " Add Record"); return(ApiResponse); }
public async Task <ActionResult <ApiResponse> > AllCategory(TblCategoryMaster tblobj) { var items = await _context.TblCategoryMaster.Where(i => i.Type == tblobj.Type).ToListAsync(); var ApiResponse = await response.ApiResult("OK", items, "Record Found"); return(ApiResponse); }
public async Task <ActionResult <ApiResponse> > AddCategory(TblCategoryMaster tblCategoryMaster) { _context.TblCategoryMaster.Add(tblCategoryMaster); await _context.SaveChangesAsync(); var ApiResponse = await response.ApiResult("OK", tblCategoryMaster.Id, " Add Record"); return(ApiResponse); }
public async Task <ActionResult <ApiResponse> > AllModel(TblCategoryMaster tblobj) { var listmodel = await _context.TblCategoryMaster.ToListAsync(); var listmodelInner = await _context.TblCategoryMaster.ToListAsync(); var items = (from lm in listmodel join lmi in listmodelInner on lm.Id equals lmi.ParentId select new { id = lm.Id, makerName = lm.CategoryType, parentId = lm.ParentId, modelName = lmi.CategoryType, type = lmi.Type, modelId = lmi.Id }) .Where(i => i.type == tblobj.Type).ToList(); var ApiResponse = await response.ApiResult("OK", items, "Record Found"); return(ApiResponse); }
public async Task <ApiResponse> UpdateCategory(TblCategoryMaster tblCategoryMaster) { _context.Entry(tblCategoryMaster).State = EntityState.Modified; try { await _context.SaveChangesAsync(); var ApiResponse = await response.ApiResult("OK", tblCategoryMaster.Id, " Update Record"); return(ApiResponse); } catch (DbUpdateConcurrencyException EX) { var ApiResponsError = await response.ApiResult("FAILED", EX, "Errro Updating"); return(ApiResponsError); } }