public ActionResult Save(MTinfounit mtInfoUnit) { string lang = Request.Form["lang"]; string langValue = Request.Form["langValue"]; List<string> array = lang.Split(',').ToList<string>(); List<string> arrayValue = langValue.Split(',').ToList<string>(); string name = string.Empty; for (int x = 0; x < array.Count; x++) { name += string.Format("{0}:{1},", array[x], arrayValue[x]); } if (name.LastIndexOf(',') > 0) name = name.Substring(0, name.Length - 1); mtInfoUnit.name = name; MTinfounitService.GetInstance().Save(mtInfoUnit); return Redirect("/mtinfounit/list/"); }
public int Save(MTinfounit entity) { if (entity.id > 0) return _mtinfoUnitDao.Update(entity); return _mtinfoUnitDao.Insert(entity); }