public ActionResult UnblockIP(IPIndexViewModel iivm) { var ip = new IPAddressPool(); ip = IPAddressPoolBLO.Current.GetById(iivm.Id); if (ip.StatusCode == Constants.StatusCode.IP_BLOCKED) { ip.StatusCode = Constants.StatusCode.IP_AVAILABLE; IPAddressPoolDAO.Current.Update(ip); var blockip = LogBLO.Current.GetBlockedIP(ip.IPAddress).FirstOrDefault(); var log = new Log(); log.TypeOfLog = Constants.TypeOfLog.LOG_UNBLOCK_IP; log.Object = Constants.Object.OBJECT_IP; log.ChangedValueOfObject = ip.IPAddress; log.ObjectStatus = Constants.StatusCode.IP_AVAILABLE; log.Description = iivm.Description; log.LogTime = DateTime.Now; log.PreviousId = blockip.Id; LogBLO.Current.Add(log); return RedirectToAction("Index", new {Message = "IP Address was unblocked!"}); } else { return RedirectToAction("Index", new { FailUnBlock = "IP Address was unblocked already!" }); } }
public ActionResult BlockIP(IPIndexViewModel iivm) { //int? id = ipid.ToInt(); var ip = new IPAddressPool(); ip = IPAddressPoolBLO.Current.GetById(iivm.Id); if (ip.StatusCode == Constants.StatusCode.IP_AVAILABLE) { ip.StatusCode = Constants.StatusCode.IP_BLOCKED; IPAddressPoolDAO.Current.AddOrUpdate(ip); var log = new Log(); log.TypeOfLog = Constants.TypeOfLog.LOG_BLOCK_IP; log.Object = Constants.Object.OBJECT_IP; log.ChangedValueOfObject = ip.IPAddress; log.ObjectStatus = Constants.StatusCode.IP_BLOCKED; log.LogTime = DateTime.Now; log.Description = iivm.Description; LogBLO.Current.Add(log); return RedirectToAction("Index", new { Message = "IP Address was blocked!" }); } else { return RedirectToAction("Index", new {FailBlock ="IP Address was blocked already!"}); } }