public override IHttpActionResult Post(Subscription model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (string.IsNullOrWhiteSpace(model.Id)) { model.Id = Guid.NewGuid().ToString(); } if (string.IsNullOrWhiteSpace(model.TenantId)) { model.TenantId = User.Identity.GetTenantId(); } model.Active = true; try { using (var scope = new TransactionScope()) { model.ExpireOn = model.ExpireOn.GetValueOrDefault().Date.AddDays(1).AddSeconds(-1); _service.AddAsTenant(model); UpdateDependance(model); scope.Complete(); } } catch (Exception exception) { Log.Logger.Write(LogEventLevel.Error, exception, String.Empty); } return(Ok(model.Id)); }
public override IHttpActionResult Post(Subscription model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (string.IsNullOrWhiteSpace(model.Id)) { model.Id = Guid.NewGuid().ToString(); } if (string.IsNullOrWhiteSpace(model.TenantId)) { model.TenantId = User.Identity.GetTenantId(); } if (string.IsNullOrWhiteSpace(model.CompanyId)) { model.CompanyId = User.Identity.GetCompanyId(); } model.Active = true; using (var scope = new TransactionScope()) { _service.AddAsTenant(model); UpdateDependency(model); scope.Complete(); } return(Ok(model.Id)); }