public String GetCategoryName(int id) { CategoryIncomeClient ac = new CategoryIncomeClient(); CategoryIncome category = ac.Find(id); return(category.Name); }
public async Task <IActionResult> PutCategoryIncome([FromRoute] int id, [FromBody] CategoryIncome CategoryIncome) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != CategoryIncome.Id) { return(BadRequest()); } _context.Entry(CategoryIncome).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CategoryIncomeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public ActionResult Edit(CategoryIncome CIVM) { CategoryIncomeClient client = new CategoryIncomeClient(); client.Edit(CIVM); return(RedirectToAction("Index")); }
public ActionResult Create(CategoryIncome CategoryIncome) { CategoryIncomeClient client = new CategoryIncomeClient(); client.Create(CategoryIncome); return(RedirectToAction("Index")); }
public async Task <IActionResult> PostCategoryIncome([FromBody] CategoryIncome CategoryIncome) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.CategoryIncome.Add(CategoryIncome); await _context.SaveChangesAsync(); return(CreatedAtAction("GetCategoryIncome", new { id = CategoryIncome.Id }, CategoryIncome)); }
public ActionResult Create() { ClaimsPrincipal currentUser = User; var userId = currentUser.FindFirst(ClaimTypes.NameIdentifier).Value; var model = new CategoryIncome { UserId = userId }; return(View(model)); }
public bool Edit(CategoryIncome CategoryIncome) { try { HttpClient client = new HttpClient { BaseAddress = new Uri(Base_URL) }; client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); HttpResponseMessage response = client.PutAsJsonAsync("CategoryIncomes/" + CategoryIncome.Id, CategoryIncome).Result; return response.IsSuccessStatusCode; } catch { return false; } }