public bool AddUnicorn(UnicornDTO data) { try { var record = new Unicorn() { UnicornName = data.UnicornName, UnicornNumber = data.UnicornNumber, UnicornOwner = data.UnicornOwner, CreatedBy = "admin", CreatedDate = DateTime.Now, }; Create(record); _uow.Save(); return(true); } catch (Exception ex) { ex.Data.Add("AddUnicorn", "An error occurred while trying to create AddUnicorn Record - DAL"); Tracer.Error(ex); _uow.Rollback(); return(false); } }
public bool UpdateUnicorn(UnicornDTO data) { using (var uow = new UnitOfWork()) { try { var isAdded = uow.UniCorn.UpdateUnicorn(data); if (isAdded == true) { return(true); } else { return(false); } } catch (Exception ex) { ex.Data.Add("UpdateUnicorn", "An error occurred while trying to UpdateUnicorn Record - BLL"); uow.Rollback(); Tracer.Error(ex); return(false); } } }
public ActionResult Create(UnicornDTO model) { var isAdded = _UnicornBusinessLayer.AddUnicorn(model); return(RedirectToAction("Index")); }
public ActionResult Update(int Id) { UnicornDTO model = new UnicornDTO(); model = _UnicornBusinessLayer.GetById(Id); return(View(model)); }
public bool UpdateUnicorn(UnicornDTO data) { try { var unicorndata = GetQuerable(x => x.Id == data.Id).FirstOrDefault(); unicorndata.UnicornName = data.UnicornName; unicorndata.UnicornNumber = data.UnicornNumber; unicorndata.UnicornOwner = data.UnicornOwner; unicorndata.CreatedBy = "Admin"; unicorndata.CreatedDate = DateTime.Now; Update(unicorndata); _uow.Save(); return(true); } catch (Exception ex) { ex.Data.Add("UpdateUnicorn", "An error occurred while trying to create UpdateUnicorn Record - DAL"); Tracer.Error(ex); _uow.Rollback(); return(false); } }
public ActionResult Update(UnicornDTO model) { var isUpdated = _UnicornBusinessLayer.UpdateUnicorn(model); return(RedirectToAction("Index")); }
public ActionResult Create() { UnicornDTO model = new UnicornDTO(); return(View(model)); }