コード例 #1
0
 public ActionResult Index()
 {
     LatestTechnologyModel Model = new LatestTechnologyModel();
     Model.SucessMessage = (TempData["Success"] != null ? TempData["Success"].ToString() : string.Empty).ToString();
     Model.ErrorMessage = (TempData["Error"] != null ? TempData["Error"].ToString() : string.Empty).ToString();
     return View(Model);
 }
コード例 #2
0
 public ActionResult Detail(int Id)
 {
     LatestTechnologyModel Model = new LatestTechnologyModel();
     LatestTechnologyBM latestTechnologyBM = new LatestTechnologyBM();
     latestTechnologyBM = latestTechnologyBL.GetTechnologyById(Id);
     Model.latestTechnologyBM = latestTechnologyBM;
     return View(Model);
 }
コード例 #3
0
        public ActionResult NewTechnology(LatestTechnologyModel Model, FormCollection collection, List<HttpPostedFileBase> file)
        {
            UserBM CurrentUser = SessionManager.InstanceCreator.Get<UserBM>(SessionKey.User);

            if (CurrentUser != null)
            {
                string url = collection["url"].ToString();
                string[] strUrlArray = new string[] { };
                if (!string.IsNullOrEmpty(url))
                    strUrlArray = url.Split(',');
                //  string filepaths = collection["file"].ToString();
                LatestTechnologyBM latestTechnologyBM = new LatestTechnologyBM();
                latestTechnologyBM.CommunityId = Model.latestTechnologyBM.CommunityId;
                latestTechnologyBM.SubCommunityId = Model.latestTechnologyBM.SubCommunityId;
                latestTechnologyBM.Tag = Model.latestTechnologyBM.Tag;
                latestTechnologyBM.Subject = Model.latestTechnologyBM.Subject;
                latestTechnologyBM.Topic = Model.latestTechnologyBM.Topic;
                latestTechnologyBM.EarnPoint = 1;
                // latestTechnologyBM.Content = Model.latestTechnologyBM.Content;
                // latestTechnologyBM.Url = Model.latestTechnologyBM.Url;
                //latestTechnologyBM.VideoUrl = Model.latestTechnologyBM.VideoUrl;
                // latestTechnologyBM.FilePath = Model.latestTechnologyBM.FilePath;
                latestTechnologyBM.UserId = CurrentUser.Id;
                latestTechnologyBM.IsActive = true;

             int Id=   latestTechnologyBL.Create(latestTechnologyBM);

             #region MultipleUrl
             foreach (var strUrl in strUrlArray)
             {
                 MasterUrlBL masterUrlBL = new MasterUrlBL();
                 MasterUrlBM masterUrlBM = new MasterUrlBM();
                 masterUrlBM.ModuleId = Id;
                 masterUrlBM.Url = strUrl;
                 masterUrlBL.Create(masterUrlBM);
             }
             #endregion
             #region MultipleFile
             foreach (var fileInstance in file)
             {
                 if (fileInstance != null)
                 {
                     string ImageName = System.IO.Path.GetFileName(fileInstance.FileName);
                     if (!Directory.Exists(Server.MapPath("~/Images/TechnologyDocument")))
                     {
                         Directory.CreateDirectory(Server.MapPath("~/Images/TechnologyDocument"));
                     }
                     string physicalPath = Server.MapPath("~/Images/TechnologyDocument/" + ImageName);
                     fileInstance.SaveAs(physicalPath);
                     //     latestTechnologyBM.FilePath = "~/Images/TechnologyDocument/" + ImageName;

                     MasterFilePathBL masterFilePathBL = new MasterFilePathBL();
                     MasterFilePathBM masterFilePathBM = new MasterFilePathBM();
                     masterFilePathBM.ModuleId = Id;
                     masterFilePathBM.FilePath = "~/Images/TechnologyDocument/" + ImageName; ;
                     masterFilePathBL.Create(masterFilePathBM);
                 }
             }
             #endregion
                TempData["Success"] = "Record Saved Successfully.";
            }
            else
            {
                TempData["Error"] = "Please Login.";
            }
            return RedirectToAction("Index");
        }