Exemple #1
0
        public JsonResult LabWorkEdit(string Name, string JsonArr, long id)
        {
            if (_labRepository.CheckLabWorkExist(Name) && (_labRepository.GetLabWorkIdByName(Name) != id))
            {
                return(Json(new JSONResultCreateLab(ResponseConstants.LabWorkExistErrorSystemName, Name)));
            }
            ;
            LabWork lab     = _labRepository.GetLabWorkById(id);
            var     message = "";

            lab.Name = Name;

            _labRepository.DeleteEntries(id);
            lab.LabEntries.Clear();

            _labRepository.ModifyLabWork(lab);
            _labRepository.SaveLabEntries(lab.Id, JsonConvert.DeserializeObject <long[]>(JsonArr));
            _labRepository.DeleteExcessTaskVariantsFromLabVariants(lab.Id);

            return(Json(new JSONResultCreateLab(ResponseConstants.LabWorkSuccessEditSystemName, Name, lab.Id)));
        }