public async Task <Payment> CreateOrUpdatePayment(PaymentDto paymentDto) { try { await _unitofWork.PaymentRepository.CreateOrUpdatePayment(paymentDto); _unitofWork.Commit(); return(null); } catch (Exception e) { _unitofWork.Rollback(); return(null); } }
public async Task <Orders> CreateOrderAsync(OrderDto orderDto) { try { await _unitofWork.OrderRepository.CreateOrderAsync(orderDto); _unitofWork.Commit(); sendMail(orderDto); return(null); } catch (Exception e) { _unitofWork.Rollback(); return(null); } }
public ActionResult Insert(EPostDTO post) { try { // _uow.BeginTransaction(); post.Slug = _postService.GetSlugAnyPost(StringManager.ToSlug(post.Title)); post.UserId = ((SessionContext)Session["SessionContext"]).Id; post.PostContent = HttpUtility.HtmlEncode(post.PostContent); if (Session["TempImage"] != null) { post.Image = (byte[])Session["TempImage"]; } _postService.Insert(post); _uow.SaveChanges(); // _uow.Commit(); return(Json(true, JsonRequestBehavior.AllowGet)); } catch (Exception) { _uow.Rollback(); return(Json(false, JsonRequestBehavior.AllowGet)); } }