示例#1
0
        public IHttpActionResult SubmitToVerify(int id)
        {
            var media = db.EventMediaInterviewRequest.Where(p => p.Id == id).FirstOrDefault();

            if (media.MediaStatus == MediaStatus.RequireAmendment)
            {
                var approval = new EventMediaInterviewApproval
                {
                    MediaId      = media.Id,
                    Level        = EventApprovalLevel.Verifier,
                    ApproverId   = 0,
                    Status       = EventApprovalStatus.None,
                    ApprovedDate = DateTime.Now,
                    Remark       = "",
                    RequireNext  = false
                };

                db.EventMediaInterviewApproval.Add(approval);
            }
            db.SaveChanges();

            if (media != null)
            {
                media.MediaStatus = MediaStatus.PendingVerified;
                db.EventMediaInterviewRequest.Attach(media);
                db.Entry(media).Property(m => m.MediaStatus).IsModified = true;
                db.Configuration.ValidateOnSaveEnabled = false;
                db.SaveChanges();

                MediaInterviewRequestApiModel model = new MediaInterviewRequestApiModel
                {
                    Id              = media.Id,
                    RefNo           = media.RefNo,
                    MediaStatus     = media.MediaStatus,
                    MediaName       = media.MediaName,
                    MediaStatusDesc = media.MediaStatus.GetDisplayName(),
                };
                return(Ok(model));
            }
            return(Ok());
        }
示例#2
0
        public IHttpActionResult RepNotAvailable(int id)
        {
            var media = db.EventMediaInterviewRequest.Where(p => p.Id == id).FirstOrDefault();

            if (media != null)
            {
                media.MediaStatus = MediaStatus.RepNotAvailable;
                db.EventMediaInterviewRequest.Attach(media);
                db.Entry(media).Property(m => m.MediaStatus).IsModified = true;
                db.Configuration.ValidateOnSaveEnabled = false;
                db.SaveChanges();

                MediaInterviewRequestApiModel model = new MediaInterviewRequestApiModel
                {
                    Id              = media.Id,
                    RefNo           = media.RefNo,
                    MediaStatus     = media.MediaStatus,
                    MediaName       = media.MediaName,
                    MediaStatusDesc = media.MediaStatus.GetDisplayName(),
                };
                return(Ok(model));
            }
            return(Ok());
        }