protected override void InitView() { // Use this to return your custom view for this Fragment // return inflater.Inflate(Resource.Layout.YourFragment, container, false); ToastUtil.ToastShort(Activity, position.ToString()); srlBlog = FindViewById <SwipeRefreshLayout>(Resource.Id.srl_blog); //srlBlog = view.FindViewById<SwipeRefreshLayout>(Resource.Id.srl_blog); recyclerview_blog = FindViewById <RecyclerView>(Resource.Id.recyclerview_blog); srlBlog.SetColorSchemeResources(Resource.Color.colorPrimary); recyclerview_blog.SetLayoutManager(new LinearLayoutManager(this.Activity)); blogPresenter = new BlogPresenter(this); adapter = new BlogAdapter(); loadMoreWrapper = new LoadMoreWrapper(adapter); recyclerview_blog.SetAdapter(loadMoreWrapper); emptyView = this.Activity.LayoutInflater.Inflate(Resource.Layout.empty, (ViewGroup)recyclerview_blog.Parent, false); failView = this.Activity.LayoutInflater.Inflate(Resource.Layout.fail, (ViewGroup)recyclerview_blog.Parent, false); srlBlog.SetOnRefreshListener(this); failView.SetOnClickListener(this); emptyView.SetOnClickListener(this); loadMoreWrapper.SetOnLoadMoreListener(this); recyclerview_blog.Post(async() => { await blogPresenter.GetLocalBlog(pageSize, position); }); }
public UserController() //Constructor { venlist = new List <RegVendorViewModel>(); bvm = new List <BlogViewModel>(); bp = new BlogPresenter(); up = new UserPresenter(); ap = new AdminsPresenter(); rvm = new RegVendorViewModel(); }
public ActionResult BlogDetails(int id) { if (string.IsNullOrEmpty(Session["US_Name"] as string)) { return(RedirectToAction("LoginUser", "User")); } else { int?count = UserPresenter.IsAdmin(Session["US_Name"] as string); if (count == 1) { BlogPresenter bp = new BlogPresenter(); _bvm = bp.GetBlogDetails(id); return(View(_bvm)); } else { return(RedirectToAction("Index", "User")); } } }
public ActionResult GetNewBlogs() { if (string.IsNullOrEmpty(Session["US_Name"] as string)) { return(RedirectToAction("LoginUser", "User")); } else { int?count = UserPresenter.IsAdmin(Session["US_Name"] as string); if (count == 1) { //string path_and_query = Request.Url.PathAndQuery; List <BlogViewModel> bvm = new List <BlogViewModel>(); BlogPresenter bp = new BlogPresenter(); bvm = bp.GetNewBlogsGet(); return(View(bvm)); } else { return(RedirectToAction("Index", "User")); } } }
public ActionResult NewBlog(BlogViewModel bvm, FormCollection fm) { try { if (ModelState.IsValid) { string username = Session["US_Name"] as string; string pname = fm["PC1_Name"]; int bytecountBlog = bvm.ImageFileForBlog.ContentLength; int bytecountBlogger = bvm.ImageFileBlogger.ContentLength; if (bytecountBlog >= 5000000 && bytecountBlogger >= 5000000) { TempData["_extension"] = "File size must be less than 5 MB."; TempData["extension"] = "File size must be less than 5 MB."; return(RedirectToAction("BlogUpload", "Blog")); } else if (bytecountBlog <= 5000000 && bytecountBlogger >= 5000000) { TempData["_extension"] = "File size must be less than 5 MB."; return(RedirectToAction("BlogUpload", "Blog")); } else if (bytecountBlog >= 5000000 && bytecountBlogger <= 5000000) { TempData["extension"] = "File size must be less than 5 MB."; return(RedirectToAction("BlogUpload", "Blog")); } else if (bytecountBlog <= 5000000 && bytecountBlogger <= 5000000) { string fileNameBlogger = Path.GetFileNameWithoutExtension(bvm.ImageFileBlogger.FileName); string extension = Path.GetExtension(bvm.ImageFileBlogger.FileName); string fileNameBlog = Path.GetFileNameWithoutExtension(bvm.ImageFileForBlog.FileName); string extensionBlog = Path.GetExtension(bvm.ImageFileForBlog.FileName); if ((extension == ".jpg" || extension == ".jpeg" || extension == ".png" || extension == ".JPG" || extension == ".JPEG" || extension == ".PNG") && (extensionBlog == ".jpg" || extensionBlog == ".jpeg" || extensionBlog == ".png" || extensionBlog == ".JPG" || extensionBlog == ".JPEG" || extensionBlog == ".PNG")) { fileNameBlogger = fileNameBlogger + DateTime.Now.ToString("yymmssfff") + extension; bvm.Blogger_PictureName = fileNameBlogger; bvm.Blogger_PicturePath = "~/Content/Pictures/BloggerPicture/" + fileNameBlogger; fileNameBlogger = Path.Combine(Server.MapPath("~/Content/Pictures/BloggerPicture/"), fileNameBlogger); bvm.ImageFileBlogger.SaveAs(fileNameBlogger); fileNameBlog = fileNameBlog + DateTime.Now.ToString("yymmssfff") + extensionBlog; bvm.Blog_PictureName = fileNameBlog; bvm.Blog_PicturePath = "~/Content/Pictures/BlogPicture/" + fileNameBlog; fileNameBlog = Path.Combine(Server.MapPath("~/Content/Pictures/BlogPicture/"), fileNameBlog); bvm.ImageFileForBlog.SaveAs(fileNameBlog); BlogPresenter bp = new BlogPresenter(); bp.BlogUploading(bvm, username, pname); TempData["ProRegMsg"] = "Blog Uploaded Successfully."; ModelState.Clear(); return(RedirectToAction("BlogUpload", "Blog")); } else if ((extension == ".jpg" || extension == ".jpeg" || extension == ".png" || extension == ".JPG" || extension == ".JPEG" || extension == ".PNG") && (extensionBlog != ".jpg" || extensionBlog != ".jpeg" || extensionBlog != ".png" || extensionBlog != ".JPG" || extensionBlog != ".JPEG" || extensionBlog != ".PNG")) { TempData["extension"] = "Only .jpg , .jpeg & .png file supported."; return(RedirectToAction("BlogUpload", "Blog")); } else if ((extension != ".jpg" || extension != ".jpeg" || extension != ".png" || extension != ".JPG" || extension != ".JPEG" || extension != ".PNG") && (extensionBlog != ".jpg" || extensionBlog != ".jpeg" || extensionBlog != ".png" || extensionBlog != ".JPG" || extensionBlog != ".JPEG" || extensionBlog != ".PNG")) { TempData["_extension"] = "Only .jpg , .jpeg & .png file supported."; TempData["extension"] = "Only .jpg , .jpeg & .png file supported."; return(RedirectToAction("BlogUpload", "Blog")); } else if ((extension != ".jpg" || extension != ".jpeg" || extension != ".png" || extension != ".JPG" || extension != ".JPEG" || extension != ".PNG") && (extensionBlog == ".jpg" || extensionBlog == ".jpeg" || extensionBlog == ".png" || extensionBlog == ".JPG" || extensionBlog == ".JPEG" || extensionBlog == ".PNG")) { TempData["_extension"] = "Only .jpg , .jpeg & .png file supported."; return(RedirectToAction("BlogUpload", "Blog")); } } } else { return(RedirectToAction("BlogUpload", "Blog")); } } catch (Exception ex) { TempData["ProRegMsg"] = "Blog Uploading Failed - " + ex.Message; } return(RedirectToAction("BlogUpload", "Blog")); }
public BlogController() //Constructor { bvm = new List <BlogViewModel>(); bp = new BlogPresenter(); _bvm = new BlogViewModel(); }
private void Login_Load(object sender, EventArgs e) { this.presenter = new BlogPresenter(this, new BlogServiceMock()); }
public void SetUp() { view = new BlogViewMock(); service = new BlogServiceMock(); presenter = new BlogPresenter(view, service); }