Пример #1
0
        public ActionResult Delete(int StoryID)
        {
            ViewBag.StoryID = StoryID;
            story story = StoryRepository.GetStoryByID(StoryID);

            return(PartialView(story));
        }
Пример #2
0
        public IActionResult edit(int id)
        {
            ViewBag.login = true;
            story st = istoryRepository.Getstory(id);

            return(View(st));
        }
Пример #3
0
        public IActionResult edit(story st)
        {
            ViewBag.login = true;
            story st1 = istoryRepository.Update(st);

            return(Redirect("~/Home/mystory"));
        }
Пример #4
0
        public ActionResult Edit(int StoryID)
        {
            story story = StoryRepository.GetStoryByID(StoryID);

            GetData(story.MinistryID);
            return(PartialView(story));
        }
Пример #5
0
        public ActionResult DeleteConfirmed(int id)
        {
            story story = db.stories.Find(id);

            db.stories.Remove(story);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #6
0
        public IActionResult create(story st)
        {
            ViewBag.login = true;
            st.userId     = HttpContext.Session.GetString(useremail);
            st.createdat  = DateTime.Now;
            story newst = istoryRepository.Add(st);

            return(Redirect("~/Home/mystory"));
        }
Пример #7
0
 public bool StorySubmit(story story)
 {
     using (objDB)
     {
         objDB.stories.InsertOnSubmit(story);
         objDB.SubmitChanges();
         return(true);
     }
 }
Пример #8
0
        public ActionResult DisplayStory(int storyID)
        {
            story story = StoryRepository.GetStoryByID(storyID);

            story.picture   = PictureRepository.GetPictureByID((int)story.PictureID);
            story.StoryType = ConstantRepository.GetConstantID((int)story.StoryTypeID).Value1;
            int GroupPictureCount = PictureRepository.GetPictureByGroup(story.MinistryID, story.StoryID).Count();

            story.HasGroupPictures = false;
            if (GroupPictureCount > 0)
            {
                story.HasGroupPictures = true;
            }
            return(PartialView(story));
        }
Пример #9
0
 public ActionResult edit(int id, story story)
 {
     ViewBag.Group = "Admin";
     if (ModelState.IsValid)
     {
         try
         {
             objStory.EditStory(id, story.author, story.email, story.title, story.story1);
             return(RedirectToAction("Admin"));
         }
         catch
         {
             return(View());
         }
     }
     return(View());
 }
Пример #10
0
        public ActionResult SubmitAction(story story)
        {
            ViewBag.Group = "AboutUs";
            if (ModelState.IsValid)
            {
                try
                {
                    objStory.StorySubmit(story);
                    return(View("SubmitAction", story));
                }

                catch
                {
                    return(View());
                }
            }

            else
            {
                return(View());
            }
        }
Пример #11
0
 public ActionResult Create(story story)
 {
     try
     {
         if (ModelState.IsValid)
         {
             story.PictureID = 1;
             if (story.StoryLine.Length > 2000)
             {
                 return(Content("Error saving: Story more than 2000 string long."));
             }
             db.stories.Add(story);
             db.SaveChanges();
             StoryRepository.AddRecord(story);
             return(Content("Story added successfully"));
         }
     }
     catch (Exception ex)
     {
         TempData["Message2"] = "Error adding story";
     }
     GetData(story.MinistryID);
     return(PartialView(story));
 }
Пример #12
0
        public IActionResult show(int id)
        {
            ViewBag.login = false;
            if (HttpContext.Session.GetString(isloggedin) == "0")
            {
                return(View("login"));
            }
            ViewBag.login = true;
            story          st    = istoryRepository.Getstory(id);
            Users          user  = iuserreposetory.fetch(st.userId);
            storyViewModel model = new storyViewModel
            {
                body      = st.body,
                title     = st.title,
                photopath = user.photopath,
                firstname = user.firstname,
                lastname  = user.lastname,
                email     = user.email,
                createdat = st.createdat,
                status    = st.status
            };

            return(View(model));
        }
Пример #13
0
    //Create a new charater
    //<param name="_name">Name.</param>

    public Character(string _name, bool enabledOnStart = true)
    {
        CharacterManager cm = CharacterManager.instance;
        //locate the character prefab
        //鎖定角色組件
        GameObject prefab = Resources.Load("Characters/Character[" + _name + "]") as GameObject;
        //spawn an instance of the prefab directly on the character panel
        //立即在角色面板上產生角色組件組合結果
        GameObject ob = GameObject.Instantiate(prefab, cm.characterPanel);

        root          = ob.GetComponent <RectTransform> ();
        characterName = _name;

        renderers.renderer = ob.GetComponentInChildren <RawImage> ();
        if (isMultiLayerCharacter)
        {
            renderers.bodyRenderer       = ob.transform.Find("bodyLayer").GetComponent <Image> ();
            renderers.expressionRenderer = ob.transform.Find("expressionlayer").GetComponent <Image>();
        }

        dialogue = story.instance;
        //Get Rebderer(s)
        enabled = enabledOnStart;
    }
Пример #14
0
        public ActionResult Edit(story story)
        {
            string ReturnUrl = Request.UrlReferrer.ToString();

            try
            {
                if (ModelState.IsValid)
                {
                    //add main picture

                    foreach (var image in story.MainPic)
                    {
                        if (image != null)
                        {
                            picture pic = new picture();
                            pic.ImageMimeType = image.ContentType;
                            pic.ImageData     = new byte[image.ContentLength];
                            image.InputStream.Read(pic.ImageData, 0, image.ContentLength);

                            pic.ministryID  = 0;
                            pic.PictureDate = System.DateTime.Today;
                            pic.Status      = "Active";
                            pic.Description = string.Format("Picture:{0}", story.Header);
                            pic.DateEntered = System.DateTime.Today;
                            pic.EnteredBy   = User.Identity.Name.ToString();

                            db.pictures.Add(pic);
                            db.SaveChanges();

                            story.PictureID = pic.pictureID;
                        }
                    }

                    db.Entry(story).State = EntityState.Modified;
                    db.SaveChanges();

                    //add related picture
                    foreach (var image in story.GroupPic)
                    {
                        if (image != null)
                        {
                            picture picture = new picture();
                            picture.ImageMimeType = image.ContentType;
                            picture.ImageData     = new byte[image.ContentLength];
                            image.InputStream.Read(picture.ImageData, 0, image.ContentLength);

                            picture.ministryID  = story.MinistryID;
                            picture.PictureDate = System.DateTime.Today;
                            picture.Status      = "Active";
                            picture.GroupID     = story.StoryID;
                            picture.Description = "";//string.Format("Picture:{0}", story.Header);
                            picture.DateEntered = System.DateTime.Today;
                            picture.EnteredBy   = User.Identity.Name.ToString();
                            db.pictures.Add(picture);
                            db.SaveChanges();
                        }
                    }
                    GetData(story.MinistryID);
                    // return Redirect("/Home/Admin?Page=Ministry");
                    return(Redirect(ReturnUrl));
                }
            }
            catch (Exception ex)
            {
                TempData["Message2"] = string.Format("Error editing story.");
            }
            GetData(story.MinistryID);
            return(View(story));
        }
Пример #15
0
 void Awake()
 {
     instance = this;
 }
Пример #16
0
 public void AddRecord(story Record)
 {
     myRecords.Add(record);
 }
Пример #17
0
 public story GetStoryByID(int storyID)
 {
     record = myRecords.FirstOrDefault(e => e.StoryID == storyID);
     return(record);
 }
Пример #18
0
 public void DeleteRecord(story record)
 {
     myRecords.Remove(record);
     context.stories.Add(record);
     context.SaveChanges();
 }