public IHttpActionResult PutMyFollow(int id, MyFollow myFollow)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     if (id != myFollow.Id)
     {
         return(BadRequest());
     }
     db.Entry(myFollow).State = EntityState.Modified;
     try
     {
         db.SaveChanges();
     }
     catch (DbUpdateConcurrencyException)
     {
         if (!MyFollowExists(id))
         {
             return(NotFound());
         }
         else
         {
             throw;
         }
     }
     return(StatusCode(HttpStatusCode.NoContent));
 }
        public IHttpActionResult PostMyFollow(MyFollow myFollow)
        {
            //顧客資料
            string      token       = Request.Headers.Authorization.Parameter;
            JwtAuthUtil jwtAuthUtil = new JwtAuthUtil();
            int         id          = Convert.ToInt32(jwtAuthUtil.GetId(token));

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var checkMyfollow = db.MyFollows.FirstOrDefault(m => m.BrandId == myFollow.BrandId && m.CustomerId == id);

            if (checkMyfollow != null)
            {
                return(Ok(new
                {
                    result = false,
                    message = "此餐車已經加入追蹤"
                }));
            }

            myFollow.CustomerId = id;
            myFollow.BrandName  = db.Brands.FirstOrDefault(b => b.Id == myFollow.BrandId).BrandName;//換成show brandid
            db.MyFollows.Add(myFollow);
            db.SaveChanges();
            return(Ok(new
            {
                result = true,
                message = "已加入追蹤",
            }));
        }
        public IHttpActionResult GetMyFollow(int id)
        {
            MyFollow myFollow = db.MyFollows.Find(id);

            if (myFollow == null)
            {
                return(NotFound());
            }
            return(Ok(myFollow));
        }
        public IHttpActionResult DeleteMyFollow(int id)
        {
            MyFollow myFollow = db.MyFollows.Find(id);

            if (myFollow == null)
            {
                return(NotFound());
            }
            db.MyFollows.Remove(myFollow);
            db.SaveChanges();
            return(Ok(new
            {
                resutl = true,
                message = "已取消追蹤",
            }));
        }
Example #5
0
 public ActionResult Create(MyFollow myFollow)
 {
     if (ModelState.IsValid)
     {
         db.MyFollows.Add(myFollow);
         db.SaveChanges();
         TempData["UserId"] = myFollow.UserId;
         if (myFollow.Role == "Product Owner")
         {
             return(RedirectToAction("Create", "ProductOwner"));
         }
         else
         {
             return(RedirectToAction("Create", "EndUser"));
         }
     }
     return(View(myFollow));
 }
Example #6
0
    public IEnumerator Timetick()
    {
        yield return(new WaitForSeconds(0.2f));

        Transform trans = this.transform.FindChild("TimetickAnim");

        if (trans)
        {
            trans.gameObject.SetActive(true);
        }

        yield return(new WaitForSeconds(3.5f));

        m_state = EFlyState.FLY_FLYING;

        yield return(new WaitForSeconds(2.0f));

        MyFollow follow = GlobalRef.s_gr.m_playCamera.AddComponent <MyFollow>();

        follow.m_target = s_rocketTrans;

        yield return(new WaitForSeconds(10f));
    }