Example #1
0
 public int Create(LatestTutorialsBM model)
 {
     LatestTutorials tutorials = ConvertToDM(model);
     uow.LatestTutorialsRepository.Add(tutorials);
     uow.Save();
     return tutorials.Id;
 }
 public ActionResult Detail(int Id)
 {
     LatestTutorialsModel Model = new LatestTutorialsModel();
     LatestTutorialsBM latestTutorialsBM = new LatestTutorialsBM();
     latestTutorialsBM = LatestTutorialsBL.GetTechnologyById(Id);
     Model.LatestTutorialsBM = latestTutorialsBM;
     return View(Model);
 }
Example #3
0
        private LatestTutorials ConvertToDM(LatestTutorialsBM model)
        {
            return new LatestTutorials
            {
                Id = model.Id,

                CommunityId = model.CommunityId,

                SubCommunityId = model.SubCommunityId,

                UserId = model.UserId,

                Subject = model.Subject,

                Tag = model.Tag,

                Topic = model.Topic,

                Content = model.Content,

                Url = model.Url,

                VideoUrl = model.VideoUrl,

                FilePath = model.FilePath,

                EarnPoint=model.EarnPoint,

                IsActive = model.IsActive

            };
        }
Example #4
0
 public void Update(LatestTutorialsBM model)
 {
     uow.LatestTutorialsRepository.Update(ConvertToDM(model));
     uow.Save();
 }
        public ActionResult NewTechnology(LatestTutorialsModel 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();
                LatestTutorialsBM latestTutorialsBM = new LatestTutorialsBM();
                latestTutorialsBM.CommunityId = Model.LatestTutorialsBM.CommunityId;
                latestTutorialsBM.SubCommunityId = Model.LatestTutorialsBM.SubCommunityId;
                latestTutorialsBM.Tag = Model.LatestTutorialsBM.Tag;
                latestTutorialsBM.Subject = Model.LatestTutorialsBM.Subject;
                latestTutorialsBM.Topic = Model.LatestTutorialsBM.Topic;
                latestTutorialsBM.EarnPoint = 1;
                // latestTechnologyBM.Content = Model.latestTechnologyBM.Content;
                // latestTechnologyBM.Url = Model.latestTechnologyBM.Url;
                //latestTechnologyBM.VideoUrl = Model.latestTechnologyBM.VideoUrl;
                // latestTechnologyBM.FilePath = Model.latestTechnologyBM.FilePath;
                latestTutorialsBM.UserId = CurrentUser.Id;
                latestTutorialsBM.IsActive = true;

              int Id=  LatestTutorialsBL.Create(latestTutorialsBM);

              #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");
        }