Ejemplo n.º 1
0
        public string Create(TargetMission tar)
        {
            try
            {
                // 任务内容中的换行符
                tar.Mission = tar.Mission.Replace(System.Environment.NewLine, "<br />");

                dbContext.TargetMissions.Add(tar);
                dbContext.SaveChanges();

                return Constants.AJAX_CREATE_SUCCESS_RETURN;

            }
            catch (Exception e1)
            {
                return "<p class='alert alert-danger'>出错了: " + e1.Message + "</p>";
            }
        }
Ejemplo n.º 2
0
        public string Edit(TargetMission tar)
        {
            try
            {
                // 任务内容中的换行符
                tar.Mission = tar.Mission.Replace(System.Environment.NewLine, "<br />");

                dbContext.Entry(tar).State = System.Data.Entity.EntityState.Modified;
                dbContext.SaveChanges();

                return Constants.AJAX_EDIT_SUCCESS_RETURN;
            }
            catch (Exception e1)
            {
                return "<p class='alert alert-danger'>出错了: " + e1.Message + "</p>";
            }
        }