public UserModel() { Roles = new List<string>(); RolesModel = new List<RoleModel>(); Country = new CountryModel(); Subscription = new SubscriptionModel(); }
public async Task<IHttpActionResult> AddSubscription(SubscriptionModel model) { try { var subscription = new Subscription(); subscription.Description = model.Description; subscription.EndDate = model.EndDate; subscription.GatewayId = model.GatewayId; subscription.IsActiveSubscription = model.IsActiveSubscription ?? true; subscription.Name = model.Name; subscription.Price = model.Price ?? 0; subscription.StartDate = model.StartDate; subscription.TimeDuration = model.TimeDurationInDays; subscription.Active = true; subscription.CreatedOn = DateTime.UtcNow; subscription.CreatedBy = User.Identity.GetUserId(); await LogHelpers.SaveLog(_Uow, "Create Subscription " + subscription.Name, User.Identity.GetUserId()); _Uow._Subscription.Add(subscription); await _Uow.CommitAsync(); return Ok(); } catch (Exception ex) { return InternalServerError(ex); } }