public int ExistMembership(CreateMembershipModel model) { using (var sql = GetSqlConnection()) { var data = sql.Query<int>("ExistMembership", new { user = model.User, type= model.TypeId }, commandType: CommandType.StoredProcedure); sql.Close(); return data.FirstOrDefault(); } }
public JsonResult Update(CreateMembershipModel model) { model.EndDate = model.StartDate.AddDays(model.Duration); _membershipService.UpdateMembership(model); return Json(1); }
public bool UpdateMembership(CreateMembershipModel model) { using (var sql = GetSqlConnection()) { var data = sql.Query<bool>("UpdateMembership", new { model.Id, model.User, typeId = model.TypeId, model.Top, model.Premium, model.Express, model.StartDate, model.EndDate, model.PriceType, model.PriceDynamic, model.Note, model.UserCreated }, commandType: CommandType.StoredProcedure); sql.Close(); return data.FirstOrDefault(); } }