Exemple #1
0
        /// <summary>
        /// Save the unaassigned tasks
        /// </summary>
        /// <param name="todo"></param>
        public void SaveUnAssignedTasks(ListTeamViewModel todo)
        {
            int loggedUserId = 0;

            if (AccountController.uName != null)
            {
                User_TuTU user = db.UserTu_Tu.Where(ac => ac.name.Equals(AccountController.uName)).FirstOrDefault();
                loggedUserId = user.uid;
            }
            ActivityDetailVIewModel act = new ActivityDetailVIewModel();

            if (todo != null)
            {
                foreach (var todoItem in todo.listbox)
                {
                    var temp        = todoItem.TItle;
                    var ActivitID   = db.Activities.Where(p => p.title.Equals(temp)).Select(p => p.actId).FirstOrDefault();
                    var actvityList = db.Activities.Find(ActivitID);
                    if (actvityList != null)
                    {
                        actvityList.assignee = loggedUserId;
                        db.SaveChanges();
                    }
                }
            }
        }
        public IHttpActionResult updateRating(Object c)
        {
            string  json       = JsonConvert.SerializeObject(c);
            JObject json1      = JObject.Parse(json);
            string  activityId = json1.GetValue("id").ToString();
            int     count      = Int32.Parse(json1.GetValue("starCount").ToString());

            Debug.WriteLine(json1.GetValue("id").ToString());

            Activity act = db.Activities.Find(activityId);

            act.starCount       = count;
            db.Entry(act).State = EntityState.Modified;
            db.SaveChanges();

            // return CreatedAtRoute("DefaultApi", new { id = act.actId },count);
            return(null);
        }
Exemple #3
0
        public IHttpActionResult PutUser_TuTU(int id, User_TutuBasicDetails user_TuTU)
        {
            // if (!ModelState.IsValid)
            //{
            //  return BadRequest(ModelState);
            //}

            if (id != user_TuTU.uid)
            {
                return(BadRequest());
            }

            //  db.Entry(user_TuTU).State = EntityState.Modified;

            try
            {
                var User_TutuBasicDetails = db.UserTu_Tu.Where(a => a.uid.Equals(id)).FirstOrDefault();
                User_TutuBasicDetails.name        = user_TuTU.name;
                User_TutuBasicDetails.email       = user_TuTU.email;
                User_TutuBasicDetails.companyName = user_TuTU.companyName;
                User_TutuBasicDetails.adminId     = user_TuTU.adminId;

                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!User_TuTUExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }