public bool HasStayOnline(Service service) { var _service = _repository.GetService(STAY_ONLINE); service.astra_SystemServices.Load(); if (service.astra_SystemServices.Contains(_service)) return true; return false; }
public bool HasRealIp(Service service) { var _service = _repository.GetService(REAL_IP); service.astra_SystemServices.Load(); if (service.astra_SystemServices.Contains(_service)) return true; return false; }
public bool EditService(Service service) { try { var _service = _repository.GetService(service.Name); if (_service != null && _service.ServiceId != service.ServiceId) throw new Exception("Service Name exist."); _repository.EditService(service); return true; } catch (Exception ex) { _validationDictionary.AddError("_FORM", "Service is not saved. " + ex.Message); return false; } }
public bool CreateService(Service service) { try { if (_repository.GetService(service.Name) != null) throw new Exception("Service Name exist."); //service.UserId = _userHelper.CurrentUserId; service.UserId = _userHelper.GetCurrentUserId; var _service = _repository.CreateService(service); if (service.SystemRealIP) _systemService.AddRealIp(_service.ServiceId); if (service.SystemStayOnline) _systemService.AddStayOnline(_service.ServiceId); return true; } catch (Exception ex) { _validationDictionary.AddError("_FORM", "Service is not saved. " + ex.Message); return false; } }
public SelectList SelectListPaymentMethods(int? selectedId) { var list = ListServices(STATUSES.Active); if (selectedId.HasValue) return new SelectList(list, "ServiceId", "Name", selectedId.Value); var paymentMethod = new Service { ServiceId = 0, Name = "Please select", Visible = true }; list.Add(paymentMethod); return new SelectList(list, "ServiceId", "Name"); }
public ActionResult Edit(Service service) { if (_service.EditService(service)) return RedirectToAction("Edit", "User", new { id = _ctx.CurrentUserId, area = "Users" }); return View(service); }