public UrlVO FindUrlByUrl(AdminContext ctx, string url) { UrlVO model = new UrlVO(); try { var query = (from u in ctx.Url where u.Url == url select new { u.Id, u.GUID, u.CreationDate, u.ExpireDate }).Single(); model.Id = FillItemForDatabase.FillItem(query.Id); model.Url = url; model.GUID = FillItemForDatabase.FillItem(query.GUID); model.CreationDate = FillItemForDatabase.FillItem(query.CreationDate); model.ExpireDate = FillItemForDatabase.FillItem(query.ExpireDate); } catch { throw; } return(model); }
public void Insert(AdminContext ctx, UrlVO model) { try { ctx.Url.Add(model); ctx.SaveChanges(); } catch { throw; } }
public void Save(UrlVO model) { try { using (var ctx = new AdminContext()) { IAdminDA da = new AdminDA(); da.Insert(ctx, model); } } catch { throw; } }
public ActionResult Admin(FormCollection collection) { UrlVO model = new UrlVO(); try { model.Url = FixUrl(collection["Url"]); model.CreationDate = TimeZone.CurrentTimeZone.ToLocalTime(DateTime.Now).Date; model.ExpireDate = model.CreationDate.AddDays(7); model.GUID = Guid.NewGuid().ToString(); new AdminBL().Save(model); return(RedirectToAction("UrlDetails", new { model.Url })); } catch (Exception ex) { TempData["UIMsg"] = new UIMessage(ex.Message, eUIMsgType.danger); return(RedirectToAction("Admin")); } }
public UrlVO GetUrlByUrl(string url) { UrlVO model = new UrlVO(); try { using (var ctx = new AdminContext()) { IAdminDA da = new AdminDA(); model = da.FindUrlByUrl(ctx, url); using (var ctxM = new MemberContext()) { IMemberDA mDa = new MemberDA(); } } } catch { throw; } return(model); }
/// <summary> /// Get Details by url /// </summary> /// <param name="url"></param> /// <returns></returns> public ActionResult UrlDetails(string url) { UrlVO model = new UrlVO(); try { model = new AdminBL().GetUrlByUrl(url); //Path ViewBag.Path = true; Path path = new Path(); path.InsertMainItemToPath((byte)eMain.Admin); path.InsertItemToPath((byte)eMain.Admin, Resource.UserInformation, "UrlDetails"); path.CreateSessionPath(); } catch (Exception ex) { TempData["UIMsg"] = new UIMessage(ex.Message, eUIMsgType.danger); return(RedirectToAction("Admin")); } return(View(model)); }