public ActionResult Add(DailyEntity model) { model.UserId = Account.UserId; //model.DailyDate = model.DailyDate.Date; model.DailyDate = DateTime.Now.Date; model.CreateTime = DateTime.Now; model.UpdateTime = DateTime.Now; return(Json(new { result = (_service.Count(DateTime.Now) <= 0 ? _service.Insert(model) : _service.Update(model)) > 0 })); }
private void button2_Click(object sender, EventArgs e) { int ma = Convert.ToInt16(tb_ma.Text); string ten = ""; string diachi = ""; decimal mucno = 0; ten = tb_ten.Text.Trim(); diachi = tb_diachi.Text.Trim(); try { mucno = Convert.ToDecimal(tb_mucno.Text.Trim()); } catch (Exception ex) { MessageBox.Show("Mức nợ phải nhấp số"); } daily dl = new daily(); dl.id = ma; dl.name = ten; dl.address = diachi; dl.mucno = mucno; bool rs = DailyService.Update(dl); if (rs) { MessageBox.Show("Thành công"); dailyForm.loadFormSach(dataGridView1); } else { MessageBox.Show("Thất bại"); } }