예제 #1
0
 public string AddRecord(int id, SavePlan record)
 {
     try {
         _conText.SavePlan.Add(record);
         _conText.SaveChanges();
         return("新增成功");
     }
     catch (Exception e) {
         return("新增失敗" + e.ToString());
     }
 }
예제 #2
0
        public string EditRecord(int id, SavePlan savePlan)
        {
            //try
            //{
            //if (old_record != null)
            //{
            //    if (new_record.Description != null) { old_record.Description = new_record.Description; }
            //    if (new_record.Money > 0) { old_record.Money = new_record.Money; }
            //    old_record.Type = new_record.Type;

            //}
            //var old_record = _conText.SavePlan.SingleOrDefault(x => x.Id == id);


            //    old_record.Description = new_record.Description;
            //    old_record.Money = new_record.Money;
            //    _conText.SaveChanges();
            //    return "編輯成功";


            //else
            //{
            //    return "要有內容喔";
            //}

            //}

            try
            {
                var old_record = _conText.SavePlan.SingleOrDefault(x => x.Id == id);
                old_record.Description = savePlan.Description;
                old_record.Money       = savePlan.Money;
                _conText.SaveChanges();
                return("success");
            }
            catch (Exception e)
            {
                return("false" + e.ToString());
            }
        }
예제 #3
0
        public string EditSaveRecord(int id, SavePlan saveplan)
        {
            var edit = _calculateService.EditRecord(id, saveplan);

            return(edit);
        }
예제 #4
0
 public string AddSaveRecord(int id, SavePlan record)
 {
     return(_calculateService.AddRecord(id, record));
 }