public ActionResult Add(string key, string code, string json)
        {
            var msg = new JsonMessage(false, "Thêm mới dữ liệu thành công.");

            try
            {
                if (key == Keyapi)
                {
                    var departmentItem = JsonConvert.DeserializeObject <DepartmentItem>(json);
                    var obj            = new DN_Department();
                    departmentItem.AgencyID = Agencyid();
                    UpdateBase(obj, departmentItem);
                    obj.DateCreate = DateTime.Now.TotalSeconds();
                    _da.Add(obj);
                    _da.Save();
                }
            }
            catch (Exception ex)
            {
                msg.Erros   = true;
                msg.Message = "Dữ liệu chưa được thêm mới";
                Log2File.LogExceptionToFile(ex);
            }
            return(Json(msg, JsonRequestBehavior.AllowGet));
        }
Example #2
0
 /// <summary>
 /// This Function is used to add new Department to database and is performed by SuperAdmin Only.
 /// </summary>
 public static bool Add(Department info)
 {
     return(DepartmentDA.Add(info));
 }