public async Task <IActionResult> Edit(long id, [Bind("Id,CategoryCode,NameRu")] PaymentCategory paymentCategory) { if (id != paymentCategory.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(paymentCategory); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PaymentCategoryExists(paymentCategory.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(paymentCategory)); }
public async Task <IActionResult> Create([Bind("Id,CategoryCode,NameRu")] PaymentCategory paymentCategory) { if (ModelState.IsValid) { _context.Add(paymentCategory); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(paymentCategory)); }
public PaymentCategory Get(int id) { var result = new PaymentCategory(); try{ result = context.PaymentCategories.Single(x => x.Id == id); }catch (System.Exception) { throw; } return(result); }
public bool Save(PaymentCategory entity) { try{ context.Add(entity); context.SaveChanges(); } catch (System.Exception) { return(false); } return(true); }
public bool Delete(int id) { try { var result = new PaymentCategory(); result = context.PaymentCategories.Single(x => x.Id == id); context.Remove(result); context.SaveChanges(); return(true); } catch (System.Exception) { throw; } }
public bool Update(PaymentCategory entity) { try{ var paymentcategoryOrigin = context.PaymentCategories.Single( x => x.Id == entity.Id ); paymentcategoryOrigin.Id = entity.Id; paymentcategoryOrigin.Name = entity.Name; paymentcategoryOrigin.Status = entity.Status; paymentcategoryOrigin.Description = entity.Description; context.Update(paymentcategoryOrigin); context.SaveChanges(); } catch (System.Exception) { return(false); } return(true); }
public static string ToDescription(this PaymentCategory category) { return(category.ToString()); }
public ActionResult Put([FromBody] PaymentCategory paymentCategory) { return(Ok( paymentCategoryService.Update(paymentCategory) )); }
public Income(string name, int dateOfMonth, double paymentAmount,string frequency, PaymentCategory category) : this(name, dateOfMonth, paymentAmount, category) { //this.Frequency = (PaymentFrequency)Enum.Parse(typeof(PaymentFrequency), frequency.ToString(),true); this.Frequency = (PaymentFrequency) MapPaymentFrequency(frequency); }
public Income(string name, int dateOfMonthPaymentMade, double incomeAmount, PaymentCategory category) : base(name, dateOfMonthPaymentMade, incomeAmount, category) { this.TypeOfPayment = PaymentType.Income; }
public void Update(PaymentCategory entity) { _paymentRepository.Update(entity); }
public Expense(string name, int dateOfMonth, double paymentAmount, PaymentCategory category) : base(name, dateOfMonth, paymentAmount, category) { this.TypeOfPayment = PaymentType.Expense; }
public Payment(string name, int dateOfMonth, double paymentAmount, PaymentCategory category) : this(name,dateOfMonth,paymentAmount) { this._paymentCategory = category; }
public ActionResult Save(PaymentCategory model) { repo.Save(model); return(RedirectToAction("Index")); }
public bool Update(PaymentCategory entity) { return(paymentRepository.Update(entity)); }
public bool Save(PaymentCategory entity) { return(paymentRepository.Save(entity)); }
public Expense(string name, int dateOfMonth, double paymentAmount,string frequency, PaymentCategory category) : this(name, dateOfMonth, paymentAmount, category) { this.Frequency = (PaymentFrequency)MapPaymentFrequency(frequency); }
public void Add(PaymentCategory entity) { _paymentRepository.Add(entity); }