public async Task <IActionResult> Donation(TXTDonationDetailView obj, string DnnActive, string DnnTaxable, string Save, string Update) { var user = await _userManager.GetUserAsync(User); if (User == null) { throw new ApplicationException($"Unable to load user with ID '{_userManager.GetUserId(User)}'."); } if (Save != null) { obj.master.Id = user.Id; obj.master.UserName = user.UserName; obj.master.DnnActive = (DnnActive == "true") ? true : false; obj.master.DnnTaxable = (DnnTaxable == "true") ? true : false; obj.master.EnterBy = user.UserName; obj.master.EnterDate = System.DateTime.Now; db.TxtdonationDetail.Add(obj.master); db.SaveChanges(); } if (Update != null) { TxtdonationDetail obj1 = new TxtdonationDetail(); obj1 = db.TxtdonationDetail.Where(x => x.Id == user.Id && x.UserName == user.UserName && x.DnnId == obj.master.DnnId).FirstOrDefault(); if (obj1 != null) { obj1.DnnDnrId = obj.master.DnnDnrId; obj1.DnnAmount = obj.master.DnnAmount; obj1.DnnType = obj.master.DnnType; obj1.DnnChequeNo = obj.master.DnnChequeNo; obj1.DnnDate = obj.master.DnnDate; obj1.DnnDcaId = obj.master.DnnDcaId; obj1.DnnDesc = obj.master.DnnDesc; obj1.DnnActive = (DnnActive == "true") ? true : false; obj1.DnnTaxable = (DnnTaxable == "true") ? true : false; obj1.EditBy = user.UserName; obj1.EditDate = System.DateTime.Now; db.SaveChanges(); } } return(RedirectToAction("showDonation")); }
public TXTDonationDetailView() { master = new TxtdonationDetail(); lstDonor = new List <TxsdonorDetail>(); lstCategory = new List <TxsdonationCategoryDetail>(); }